Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: tests/lib/convert/unicode_tests.dart

Issue 22854028: Fix off-by-one error in UTF-8 encoding. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add more tests. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/convert/utf.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/convert/unicode_tests.dart
diff --git a/tests/lib/convert/unicode_tests.dart b/tests/lib/convert/unicode_tests.dart
index 1f90b7bed3b69891484f2a3f7a530186e241c48b..52a7b093f86618ecc1596c534e9b601fea63d8e5 100644
--- a/tests/lib/convert/unicode_tests.dart
+++ b/tests/lib/convert/unicode_tests.dart
@@ -45,6 +45,24 @@ const ASCII_BYTES = const [ 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
0x79, 0x7A ];
const ASCII_STRING = "abcdefghijklmnopqrstuvwxyz";
+const BIGGEST_ASCII_BYTES = const [ 0x7F ];
+const BIGGEST_ASCII_STRING = "\x7F";
+
+const SMALLEST_2_UTF8_UNIT_BYTES = const [ 0xC2, 0x80 ];
+const SMALLEST_2_UTF8_UNIT_STRING = "\u{80}";
+
+const BIGGEST_2_UTF8_UNIT_BYTES = const [ 0xDF, 0xBF ];
+const BIGGEST_2_UTF8_UNIT_STRING = "\u{7FF}";
+
+const SMALLEST_3_UTF8_UNIT_BYTES = const [ 0xE0, 0xA0, 0x80 ];
+const SMALLEST_3_UTF8_UNIT_STRING = "\u{800}";
+
+const BIGGEST_3_UTF8_UNIT_BYTES = const [ 0xEF, 0xBF, 0xBF ];
+const BIGGEST_3_UTF8_UNIT_STRING = "\u{FFFF}";
+
+const SMALLEST_4_UTF8_UNIT_BYTES = const [ 0xF0, 0x90, 0x80, 0x80 ];
+const SMALLEST_4_UTF8_UNIT_STRING = "\u{10000}";
+
const _TEST_PAIRS = const [
const [ const [], "" ],
const [ INTER_BYTES, INTER_STRING ],
@@ -53,7 +71,14 @@ const _TEST_PAIRS = const [
const [ SIVA_BYTES2, SIVA_STRING2 ],
const [ BEE_BYTES, BEE_STRING ],
const [ DIGIT_BYTES, DIGIT_STRING ],
- const [ ASCII_BYTES, ASCII_STRING ]];
+ const [ ASCII_BYTES, ASCII_STRING ],
+ const [ BIGGEST_ASCII_BYTES, BIGGEST_ASCII_STRING ],
+ const [ SMALLEST_2_UTF8_UNIT_BYTES, SMALLEST_2_UTF8_UNIT_STRING ],
+ const [ BIGGEST_2_UTF8_UNIT_BYTES, BIGGEST_2_UTF8_UNIT_STRING ],
+ const [ SMALLEST_3_UTF8_UNIT_BYTES, SMALLEST_3_UTF8_UNIT_STRING ],
+ const [ BIGGEST_3_UTF8_UNIT_BYTES, BIGGEST_3_UTF8_UNIT_STRING ],
+ const [ SMALLEST_4_UTF8_UNIT_BYTES, SMALLEST_4_UTF8_UNIT_STRING ],
+ ];
List<List> _expandTestPairs() {
assert(2 == BEE_STRING.length);
« no previous file with comments | « sdk/lib/convert/utf.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698