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

Side by Side Diff: test/codegen/lib/convert/unicode_tests.dart

Issue 1965563003: Update dart:convert and dart:core Uri. (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library unicode_tests;
6
7 // Google favorite: "Îñţérñåţîöñåļîžåţîờñ".
8 const INTER_BYTES = const [0xc3, 0x8e, 0xc3, 0xb1, 0xc5, 0xa3, 0xc3, 0xa9, 0x72,
9 0xc3, 0xb1, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xc3,
10 0xb6, 0xc3, 0xb1, 0xc3, 0xa5, 0xc4, 0xbc, 0xc3, 0xae,
11 0xc5, 0xbe, 0xc3, 0xa5, 0xc5, 0xa3, 0xc3, 0xae, 0xe1,
12 0xbb, 0x9d, 0xc3, 0xb1];
13 const INTER_STRING = "Îñţérñåţîöñåļîžåţîờñ";
14
15 // Blueberry porridge in Danish: "blåbærgrød".
16 const BLUEBERRY_BYTES = const [0x62, 0x6c, 0xc3, 0xa5, 0x62, 0xc3, 0xa6, 0x72,
17 0x67, 0x72, 0xc3, 0xb8, 0x64];
18 const BLUEBERRY_STRING = "blåbærgrød";
19
20 // "சிவா அணாமாைல", that is "Siva Annamalai" in Tamil.
21 const SIVA_BYTES1 = const [0xe0, 0xae, 0x9a, 0xe0, 0xae, 0xbf, 0xe0, 0xae, 0xb5,
22 0xe0, 0xae, 0xbe, 0x20, 0xe0, 0xae, 0x85, 0xe0, 0xae,
23 0xa3, 0xe0, 0xae, 0xbe, 0xe0, 0xae, 0xae, 0xe0, 0xae,
24 0xbe, 0xe0, 0xaf, 0x88, 0xe0, 0xae, 0xb2];
25 const SIVA_STRING1 = "சிவா அணாமாைல";
26
27 // "िसवा अणामालै", that is "Siva Annamalai" in Devanagari.
28 const SIVA_BYTES2 = const [0xe0, 0xa4, 0xbf, 0xe0, 0xa4, 0xb8, 0xe0, 0xa4, 0xb5,
29 0xe0, 0xa4, 0xbe, 0x20, 0xe0, 0xa4, 0x85, 0xe0, 0xa4,
30 0xa3, 0xe0, 0xa4, 0xbe, 0xe0, 0xa4, 0xae, 0xe0, 0xa4,
31 0xbe, 0xe0, 0xa4, 0xb2, 0xe0, 0xa5, 0x88];
32 const SIVA_STRING2 = "िसवा अणामालै";
33
34 // DESERET CAPITAL LETTER BEE, unicode 0x10412(0xD801+0xDC12)
35 // UTF-8: F0 90 90 92
36 const BEE_BYTES = const [0xf0, 0x90, 0x90, 0x92];
37 const BEE_STRING = "𐐒";
38
39 const DIGIT_BYTES = const [ 0x35 ];
40 const DIGIT_STRING = "5";
41
42 const ASCII_BYTES = const [ 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
43 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70,
44 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
45 0x79, 0x7A ];
46 const ASCII_STRING = "abcdefghijklmnopqrstuvwxyz";
47
48 const BIGGEST_ASCII_BYTES = const [ 0x7F ];
49 const BIGGEST_ASCII_STRING = "\x7F";
50
51 const SMALLEST_2_UTF8_UNIT_BYTES = const [ 0xC2, 0x80 ];
52 const SMALLEST_2_UTF8_UNIT_STRING = "\u{80}";
53
54 const BIGGEST_2_UTF8_UNIT_BYTES = const [ 0xDF, 0xBF ];
55 const BIGGEST_2_UTF8_UNIT_STRING = "\u{7FF}";
56
57 const SMALLEST_3_UTF8_UNIT_BYTES = const [ 0xE0, 0xA0, 0x80 ];
58 const SMALLEST_3_UTF8_UNIT_STRING = "\u{800}";
59
60 const BIGGEST_3_UTF8_UNIT_BYTES = const [ 0xEF, 0xBF, 0xBF ];
61 const BIGGEST_3_UTF8_UNIT_STRING = "\u{FFFF}";
62
63 const SMALLEST_4_UTF8_UNIT_BYTES = const [ 0xF0, 0x90, 0x80, 0x80 ];
64 const SMALLEST_4_UTF8_UNIT_STRING = "\u{10000}";
65
66 const BIGGEST_4_UTF8_UNIT_BYTES = const [ 0xF4, 0x8F, 0xBF, 0xBF ];
67 const BIGGEST_4_UTF8_UNIT_STRING = "\u{10FFFF}";
68
69 const _TEST_PAIRS = const [
70 const [ const [], "" ],
71 const [ INTER_BYTES, INTER_STRING ],
72 const [ BLUEBERRY_BYTES, BLUEBERRY_STRING ],
73 const [ SIVA_BYTES1, SIVA_STRING1 ],
74 const [ SIVA_BYTES2, SIVA_STRING2 ],
75 const [ BEE_BYTES, BEE_STRING ],
76 const [ DIGIT_BYTES, DIGIT_STRING ],
77 const [ ASCII_BYTES, ASCII_STRING ],
78 const [ BIGGEST_ASCII_BYTES, BIGGEST_ASCII_STRING ],
79 const [ SMALLEST_2_UTF8_UNIT_BYTES, SMALLEST_2_UTF8_UNIT_STRING ],
80 const [ BIGGEST_2_UTF8_UNIT_BYTES, BIGGEST_2_UTF8_UNIT_STRING ],
81 const [ SMALLEST_3_UTF8_UNIT_BYTES, SMALLEST_3_UTF8_UNIT_STRING ],
82 const [ BIGGEST_3_UTF8_UNIT_BYTES, BIGGEST_3_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 ],
85 ];
86
87 List<List> _expandTestPairs() {
88 assert(2 == BEE_STRING.length);
89 var tests = [];
90 tests.addAll(_TEST_PAIRS);
91 tests.addAll(_TEST_PAIRS.map((test) {
92 var bytes = test[0];
93 var string = test[1];
94 var longBytes = [];
95 var longString = "";
96 for (int i = 0; i < 100; i++) {
97 longBytes.addAll(bytes);
98 longString += string;
99 }
100 return [longBytes, longString];
101 }));
102 return tests;
103 }
104
105 final List UNICODE_TESTS = _expandTestPairs();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698