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

Side by Side Diff: tests/lib/convert/unicode_tests.dart

Issue 25463003: Fix UTF8 encoder for Unicode runes > 0xFFFF. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload due to error. Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/convert/utf.dart ('k') | tests/lib/convert/utf85_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library unicode_tests; 5 library unicode_tests;
6 6
7 // Google favorite: "Îñţérñåţîöñåļîžåţîờñ". 7 // Google favorite: "Îñţérñåţîöñåļîžåţîờñ".
8 const INTER_BYTES = const [0xc3, 0x8e, 0xc3, 0xb1, 0xc5, 0xa3, 0xc3, 0xa9, 0x72, 8 const INTER_BYTES = const [0xc3, 0x8e, 0xc3, 0xb1, 0xc5, 0xa3, 0xc3, 0xa9, 0x72,
9 0xc3, 0xb1, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xc3, 9 0xc3, 0xb1, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xc3,
10 0xb6, 0xc3, 0xb1, 0xc3, 0xa5, 0xc4, 0xbc, 0xc3, 0xae, 10 0xb6, 0xc3, 0xb1, 0xc3, 0xa5, 0xc4, 0xbc, 0xc3, 0xae,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 const SMALLEST_3_UTF8_UNIT_BYTES = const [ 0xE0, 0xA0, 0x80 ]; 57 const SMALLEST_3_UTF8_UNIT_BYTES = const [ 0xE0, 0xA0, 0x80 ];
58 const SMALLEST_3_UTF8_UNIT_STRING = "\u{800}"; 58 const SMALLEST_3_UTF8_UNIT_STRING = "\u{800}";
59 59
60 const BIGGEST_3_UTF8_UNIT_BYTES = const [ 0xEF, 0xBF, 0xBF ]; 60 const BIGGEST_3_UTF8_UNIT_BYTES = const [ 0xEF, 0xBF, 0xBF ];
61 const BIGGEST_3_UTF8_UNIT_STRING = "\u{FFFF}"; 61 const BIGGEST_3_UTF8_UNIT_STRING = "\u{FFFF}";
62 62
63 const SMALLEST_4_UTF8_UNIT_BYTES = const [ 0xF0, 0x90, 0x80, 0x80 ]; 63 const SMALLEST_4_UTF8_UNIT_BYTES = const [ 0xF0, 0x90, 0x80, 0x80 ];
64 const SMALLEST_4_UTF8_UNIT_STRING = "\u{10000}"; 64 const SMALLEST_4_UTF8_UNIT_STRING = "\u{10000}";
65 65
66 const BIGGEST_4_UTF8_UNIT_BYTES = const [ 0xF4, 0x8F, 0xBF, 0xBF ];
67 const BIGGEST_4_UTF8_UNIT_STRING = "\u{10FFFF}";
68
66 const _TEST_PAIRS = const [ 69 const _TEST_PAIRS = const [
67 const [ const [], "" ], 70 const [ const [], "" ],
68 const [ INTER_BYTES, INTER_STRING ], 71 const [ INTER_BYTES, INTER_STRING ],
69 const [ BLUEBERRY_BYTES, BLUEBERRY_STRING ], 72 const [ BLUEBERRY_BYTES, BLUEBERRY_STRING ],
70 const [ SIVA_BYTES1, SIVA_STRING1 ], 73 const [ SIVA_BYTES1, SIVA_STRING1 ],
71 const [ SIVA_BYTES2, SIVA_STRING2 ], 74 const [ SIVA_BYTES2, SIVA_STRING2 ],
72 const [ BEE_BYTES, BEE_STRING ], 75 const [ BEE_BYTES, BEE_STRING ],
73 const [ DIGIT_BYTES, DIGIT_STRING ], 76 const [ DIGIT_BYTES, DIGIT_STRING ],
74 const [ ASCII_BYTES, ASCII_STRING ], 77 const [ ASCII_BYTES, ASCII_STRING ],
75 const [ BIGGEST_ASCII_BYTES, BIGGEST_ASCII_STRING ], 78 const [ BIGGEST_ASCII_BYTES, BIGGEST_ASCII_STRING ],
76 const [ SMALLEST_2_UTF8_UNIT_BYTES, SMALLEST_2_UTF8_UNIT_STRING ], 79 const [ SMALLEST_2_UTF8_UNIT_BYTES, SMALLEST_2_UTF8_UNIT_STRING ],
77 const [ BIGGEST_2_UTF8_UNIT_BYTES, BIGGEST_2_UTF8_UNIT_STRING ], 80 const [ BIGGEST_2_UTF8_UNIT_BYTES, BIGGEST_2_UTF8_UNIT_STRING ],
78 const [ SMALLEST_3_UTF8_UNIT_BYTES, SMALLEST_3_UTF8_UNIT_STRING ], 81 const [ SMALLEST_3_UTF8_UNIT_BYTES, SMALLEST_3_UTF8_UNIT_STRING ],
79 const [ BIGGEST_3_UTF8_UNIT_BYTES, BIGGEST_3_UTF8_UNIT_STRING ], 82 const [ BIGGEST_3_UTF8_UNIT_BYTES, BIGGEST_3_UTF8_UNIT_STRING ],
80 const [ SMALLEST_4_UTF8_UNIT_BYTES, SMALLEST_4_UTF8_UNIT_STRING ], 83 const [ SMALLEST_4_UTF8_UNIT_BYTES, SMALLEST_4_UTF8_UNIT_STRING ],
84 const [ BIGGEST_4_UTF8_UNIT_BYTES, BIGGEST_4_UTF8_UNIT_STRING ],
81 ]; 85 ];
82 86
83 List<List> _expandTestPairs() { 87 List<List> _expandTestPairs() {
84 assert(2 == BEE_STRING.length); 88 assert(2 == BEE_STRING.length);
85 var tests = []; 89 var tests = [];
86 tests.addAll(_TEST_PAIRS); 90 tests.addAll(_TEST_PAIRS);
87 tests.addAll(_TEST_PAIRS.expand((test) { 91 tests.addAll(_TEST_PAIRS.expand((test) {
88 var bytes = test[0]; 92 var bytes = test[0];
89 var string = test[1]; 93 var string = test[1];
90 var longBytes = []; 94 var longBytes = [];
91 var longString = ""; 95 var longString = "";
92 for (int i = 0; i < 100; i++) { 96 for (int i = 0; i < 100; i++) {
93 longBytes.addAll(bytes); 97 longBytes.addAll(bytes);
94 longString += string; 98 longString += string;
95 } 99 }
96 return [test, [longBytes, longString]]; 100 return [test, [longBytes, longString]];
97 })); 101 }));
98 return tests; 102 return tests;
99 } 103 }
100 104
101 final List UNICODE_TESTS = _expandTestPairs(); 105 final List UNICODE_TESTS = _expandTestPairs();
OLDNEW
« no previous file with comments | « sdk/lib/convert/utf.dart ('k') | tests/lib/convert/utf85_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698