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

Side by Side Diff: utils/tests/string_encoding/utf8_test.dart

Issue 10919024: - Change "static final" to "static const" in the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « utils/tests/string_encoding/utf32_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 #library("utf8_tests"); 6 #library("utf8_tests");
7 #import("dunit.dart"); 7 #import("dunit.dart");
8 #import("../../../lib/utf/utf.dart"); 8 #import("../../../lib/utf/utf.dart");
9 9
10 void main() { 10 void main() {
11 TestSuite suite = new TestSuite(); 11 TestSuite suite = new TestSuite();
12 suite.registerTestClass(new Utf8Tests()); 12 suite.registerTestClass(new Utf8Tests());
13 suite.run(); 13 suite.run();
14 } 14 }
15 15
16 class Utf8Tests extends TestClass { 16 class Utf8Tests extends TestClass {
17 static final String testEnglishPhrase = 17 static const String testEnglishPhrase =
18 "The quick brown fox jumps over the lazy dog."; 18 "The quick brown fox jumps over the lazy dog.";
19 19
20 static final List<int> testEnglishUtf8 = const<int> [ 20 static const List<int> testEnglishUtf8 = const<int> [
21 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63, 21 0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63,
22 0x6b, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x6e, 0x20, 22 0x6b, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x6e, 0x20,
23 0x66, 0x6f, 0x78, 0x20, 0x6a, 0x75, 0x6d, 0x70, 23 0x66, 0x6f, 0x78, 0x20, 0x6a, 0x75, 0x6d, 0x70,
24 0x73, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x20, 0x74, 24 0x73, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x20, 0x74,
25 0x68, 0x65, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x20, 25 0x68, 0x65, 0x20, 0x6c, 0x61, 0x7a, 0x79, 0x20,
26 0x64, 0x6f, 0x67, 0x2e]; 26 0x64, 0x6f, 0x67, 0x2e];
27 27
28 static final String testDanishPhrase = "Quizdeltagerne spiste jordbær med " + 28 static const String testDanishPhrase = "Quizdeltagerne spiste jordbær med " +
29 "fløde mens cirkusklovnen Wolther spillede på xylofon."; 29 "fløde mens cirkusklovnen Wolther spillede på xylofon.";
30 30
31 static final List<int> testDanishUtf8 = const<int>[ 31 static const List<int> testDanishUtf8 = const<int>[
32 0x51, 0x75, 0x69, 0x7a, 0x64, 0x65, 0x6c, 0x74, 32 0x51, 0x75, 0x69, 0x7a, 0x64, 0x65, 0x6c, 0x74,
33 0x61, 0x67, 0x65, 0x72, 0x6e, 0x65, 0x20, 0x73, 33 0x61, 0x67, 0x65, 0x72, 0x6e, 0x65, 0x20, 0x73,
34 0x70, 0x69, 0x73, 0x74, 0x65, 0x20, 0x6a, 0x6f, 34 0x70, 0x69, 0x73, 0x74, 0x65, 0x20, 0x6a, 0x6f,
35 0x72, 0x64, 0x62, 0xc3, 0xa6, 0x72, 0x20, 0x6d, 35 0x72, 0x64, 0x62, 0xc3, 0xa6, 0x72, 0x20, 0x6d,
36 0x65, 0x64, 0x20, 0x66, 0x6c, 0xc3, 0xb8, 0x64, 36 0x65, 0x64, 0x20, 0x66, 0x6c, 0xc3, 0xb8, 0x64,
37 0x65, 0x20, 0x6d, 0x65, 0x6e, 0x73, 0x20, 0x63, 37 0x65, 0x20, 0x6d, 0x65, 0x6e, 0x73, 0x20, 0x63,
38 0x69, 0x72, 0x6b, 0x75, 0x73, 0x6b, 0x6c, 0x6f, 38 0x69, 0x72, 0x6b, 0x75, 0x73, 0x6b, 0x6c, 0x6f,
39 0x76, 0x6e, 0x65, 0x6e, 0x20, 0x57, 0x6f, 0x6c, 39 0x76, 0x6e, 0x65, 0x6e, 0x20, 0x57, 0x6f, 0x6c,
40 0x74, 0x68, 0x65, 0x72, 0x20, 0x73, 0x70, 0x69, 40 0x74, 0x68, 0x65, 0x72, 0x20, 0x73, 0x70, 0x69,
41 0x6c, 0x6c, 0x65, 0x64, 0x65, 0x20, 0x70, 0xc3, 41 0x6c, 0x6c, 0x65, 0x64, 0x65, 0x20, 0x70, 0xc3,
42 0xa5, 0x20, 0x78, 0x79, 0x6c, 0x6f, 0x66, 0x6f, 42 0xa5, 0x20, 0x78, 0x79, 0x6c, 0x6f, 0x66, 0x6f,
43 0x6e, 0x2e]; 43 0x6e, 0x2e];
44 44
45 // unusual formatting due to strange editor interaction w/ text direction. 45 // unusual formatting due to strange editor interaction w/ text direction.
46 static final String 46 static const String
47 testHebrewPhrase = "דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקליטה"; 47 testHebrewPhrase = "דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקליטה";
48 48
49 static final List<int> testHebrewUtf8 = const<int>[ 49 static const List<int> testHebrewUtf8 = const<int>[
50 0xd7, 0x93, 0xd7, 0x92, 0x20, 0xd7, 0xa1, 0xd7, 50 0xd7, 0x93, 0xd7, 0x92, 0x20, 0xd7, 0xa1, 0xd7,
51 0xa7, 0xd7, 0xa8, 0xd7, 0x9f, 0x20, 0xd7, 0xa9, 51 0xa7, 0xd7, 0xa8, 0xd7, 0x9f, 0x20, 0xd7, 0xa9,
52 0xd7, 0x98, 0x20, 0xd7, 0x91, 0xd7, 0x99, 0xd7, 52 0xd7, 0x98, 0x20, 0xd7, 0x91, 0xd7, 0x99, 0xd7,
53 0x9d, 0x20, 0xd7, 0x9e, 0xd7, 0x90, 0xd7, 0x95, 53 0x9d, 0x20, 0xd7, 0x9e, 0xd7, 0x90, 0xd7, 0x95,
54 0xd7, 0x9b, 0xd7, 0x96, 0xd7, 0x91, 0x20, 0xd7, 54 0xd7, 0x9b, 0xd7, 0x96, 0xd7, 0x91, 0x20, 0xd7,
55 0x95, 0xd7, 0x9c, 0xd7, 0xa4, 0xd7, 0xaa, 0xd7, 55 0x95, 0xd7, 0x9c, 0xd7, 0xa4, 0xd7, 0xaa, 0xd7,
56 0xa2, 0x20, 0xd7, 0x9e, 0xd7, 0xa6, 0xd7, 0x90, 56 0xa2, 0x20, 0xd7, 0x9e, 0xd7, 0xa6, 0xd7, 0x90,
57 0x20, 0xd7, 0x9c, 0xd7, 0x95, 0x20, 0xd7, 0x97, 57 0x20, 0xd7, 0x9c, 0xd7, 0x95, 0x20, 0xd7, 0x97,
58 0xd7, 0x91, 0xd7, 0xa8, 0xd7, 0x94, 0x20, 0xd7, 58 0xd7, 0x91, 0xd7, 0xa8, 0xd7, 0x94, 0x20, 0xd7,
59 0x90, 0xd7, 0x99, 0xd7, 0x9a, 0x20, 0xd7, 0x94, 59 0x90, 0xd7, 0x99, 0xd7, 0x9a, 0x20, 0xd7, 0x94,
60 0xd7, 0xa7, 0xd7, 0x9c, 0xd7, 0x99, 0xd7, 0x98, 60 0xd7, 0xa7, 0xd7, 0x9c, 0xd7, 0x99, 0xd7, 0x98,
61 0xd7, 0x94]; 61 0xd7, 0x94];
62 62
63 static final String testRussianPhrase = "Съешь же ещё этих мягких " + 63 static const String testRussianPhrase = "Съешь же ещё этих мягких " +
64 "французских булок да выпей чаю"; 64 "французских булок да выпей чаю";
65 65
66 static final List<int> testRussianUtf8 = const<int>[ 66 static const List<int> testRussianUtf8 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0xb0, 0x20, 0xd0, 0xb2, 0xd1, 0x8b,
78 0xd0, 0xbf, 0xd0, 0xb5, 0xd0, 0xb9, 0x20, 0xd1, 78 0xd0, 0xbf, 0xd0, 0xb5, 0xd0, 0xb9, 0x20, 0xd1,
79 0x87, 0xd0, 0xb0, 0xd1, 0x8e]; 79 0x87, 0xd0, 0xb0, 0xd1, 0x8e];
80 80
81 static final String testGreekPhrase = "Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ " + 81 static const String testGreekPhrase = "Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ " +
82 "στὸ χρυσαφὶ ξέφωτο"; 82 "στὸ χρυσαφὶ ξέφωτο";
83 83
84 static final List<int> testGreekUtf8 = const<int>[ 84 static const List<int> testGreekUtf8 = const<int>[
85 0xce, 0x93, 0xce, 0xb1, 0xce, 0xb6, 0xce, 0xad, 85 0xce, 0x93, 0xce, 0xb1, 0xce, 0xb6, 0xce, 0xad,
86 0xce, 0xb5, 0xcf, 0x82, 0x20, 0xce, 0xba, 0xce, 86 0xce, 0xb5, 0xcf, 0x82, 0x20, 0xce, 0xba, 0xce,
87 0xb1, 0xe1, 0xbd, 0xb6, 0x20, 0xce, 0xbc, 0xcf, 87 0xb1, 0xe1, 0xbd, 0xb6, 0x20, 0xce, 0xbc, 0xcf,
88 0x85, 0xcf, 0x81, 0xcf, 0x84, 0xce, 0xb9, 0xe1, 88 0x85, 0xcf, 0x81, 0xcf, 0x84, 0xce, 0xb9, 0xe1,
89 0xbd, 0xb2, 0xcf, 0x82, 0x20, 0xce, 0xb4, 0xe1, 89 0xbd, 0xb2, 0xcf, 0x82, 0x20, 0xce, 0xb4, 0xe1,
90 0xbd, 0xb2, 0xce, 0xbd, 0x20, 0xce, 0xb8, 0xe1, 90 0xbd, 0xb2, 0xce, 0xbd, 0x20, 0xce, 0xb8, 0xe1,
91 0xbd, 0xb0, 0x20, 0xce, 0xb2, 0xcf, 0x81, 0xe1, 91 0xbd, 0xb0, 0x20, 0xce, 0xb2, 0xcf, 0x81, 0xe1,
92 0xbf, 0xb6, 0x20, 0xcf, 0x80, 0xce, 0xb9, 0xe1, 92 0xbf, 0xb6, 0x20, 0xcf, 0x80, 0xce, 0xb9, 0xe1,
93 0xbd, 0xb0, 0x20, 0xcf, 0x83, 0xcf, 0x84, 0xe1, 93 0xbd, 0xb0, 0x20, 0xcf, 0x83, 0xcf, 0x84, 0xe1,
94 0xbd, 0xb8, 0x20, 0xcf, 0x87, 0xcf, 0x81, 0xcf, 94 0xbd, 0xb8, 0x20, 0xcf, 0x87, 0xcf, 0x81, 0xcf,
95 0x85, 0xcf, 0x83, 0xce, 0xb1, 0xcf, 0x86, 0xe1, 95 0x85, 0xcf, 0x83, 0xce, 0xb1, 0xcf, 0x86, 0xe1,
96 0xbd, 0xb6, 0x20, 0xce, 0xbe, 0xce, 0xad, 0xcf, 96 0xbd, 0xb6, 0x20, 0xce, 0xbe, 0xce, 0xad, 0xcf,
97 0x86, 0xcf, 0x89, 0xcf, 0x84, 0xce, 0xbf]; 97 0x86, 0xcf, 0x89, 0xcf, 0x84, 0xce, 0xbf];
98 98
99 static final String testKatakanaPhrase = """ 99 static const String testKatakanaPhrase = """
100 イロハニホヘト チリヌルヲ ワカヨタレソ ツネナラム 100 イロハニホヘト チリヌルヲ ワカヨタレソ ツネナラム
101 ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン"""; 101 ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン""";
102 102
103 static final List<int> testKatakanaUtf8 = const<int>[ 103 static const List<int> testKatakanaUtf8 = const<int>[
104 0xe3, 0x82, 0xa4, 0xe3, 0x83, 0xad, 0xe3, 0x83, 104 0xe3, 0x82, 0xa4, 0xe3, 0x83, 0xad, 0xe3, 0x83,
105 0x8f, 0xe3, 0x83, 0x8b, 0xe3, 0x83, 0x9b, 0xe3, 105 0x8f, 0xe3, 0x83, 0x8b, 0xe3, 0x83, 0x9b, 0xe3,
106 0x83, 0x98, 0xe3, 0x83, 0x88, 0x20, 0xe3, 0x83, 106 0x83, 0x98, 0xe3, 0x83, 0x88, 0x20, 0xe3, 0x83,
107 0x81, 0xe3, 0x83, 0xaa, 0xe3, 0x83, 0x8c, 0xe3, 107 0x81, 0xe3, 0x83, 0xaa, 0xe3, 0x83, 0x8c, 0xe3,
108 0x83, 0xab, 0xe3, 0x83, 0xb2, 0x20, 0xe3, 0x83, 108 0x83, 0xab, 0xe3, 0x83, 0xb2, 0x20, 0xe3, 0x83,
109 0xaf, 0xe3, 0x82, 0xab, 0xe3, 0x83, 0xa8, 0xe3, 109 0xaf, 0xe3, 0x82, 0xab, 0xe3, 0x83, 0xa8, 0xe3,
110 0x82, 0xbf, 0xe3, 0x83, 0xac, 0xe3, 0x82, 0xbd, 110 0x82, 0xbf, 0xe3, 0x83, 0xac, 0xe3, 0x82, 0xbd,
111 0x20, 0xe3, 0x83, 0x84, 0xe3, 0x83, 0x8d, 0xe3, 111 0x20, 0xe3, 0x83, 0x84, 0xe3, 0x83, 0x8d, 0xe3,
112 0x83, 0x8a, 0xe3, 0x83, 0xa9, 0xe3, 0x83, 0xa0, 112 0x83, 0x8a, 0xe3, 0x83, 0xa9, 0xe3, 0x83, 0xa0,
113 0x0a, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xb0, 0xe3, 113 0x0a, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xb0, 0xe3,
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 466
467 IterableUtf8Decoder kataDecoder = decodeUtf8AsIterable(testKatakanaUtf8); 467 IterableUtf8Decoder kataDecoder = decodeUtf8AsIterable(testKatakanaUtf8);
468 // get the first character 468 // get the first character
469 Expect.equals(testKatakanaPhrase.charCodes()[0], 469 Expect.equals(testKatakanaPhrase.charCodes()[0],
470 kataDecoder.iterator().next()); 470 kataDecoder.iterator().next());
471 // get the whole translation using the Iterable interface 471 // get the whole translation using the Iterable interface
472 Expect.stringEquals(testKatakanaPhrase, 472 Expect.stringEquals(testKatakanaPhrase,
473 new String.fromCharCodes(new List<int>.from(kataDecoder))); 473 new String.fromCharCodes(new List<int>.from(kataDecoder)));
474 } 474 }
475 } 475 }
OLDNEW
« no previous file with comments | « utils/tests/string_encoding/utf32_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698