OLD | NEW |
| (Empty) |
1 #!/usr/bin/env dart | |
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 | |
4 // BSD-style license that can be found in the LICENSE file. | |
5 | |
6 #library("unicode_tests"); | |
7 #import("dunit.dart"); | |
8 #import("../../../lib/utf/utf.dart"); | |
9 | |
10 void main() { | |
11 TestSuite suite = new TestSuite(); | |
12 suite.registerTestClass(new UnicodeTests()); | |
13 suite.run(); | |
14 } | |
15 | |
16 class UnicodeTests extends TestClass { | |
17 static final String testPhrase = | |
18 "The quick brown fox jumps over the lazy dog."; | |
19 | |
20 static final List<int> testCodepoints = const<int> [ | |
21 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, | |
22 32, 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101, 114, | |
23 32, 116, 104, 101, 32, 108, 97, 122, 121, 32, 100, 111, 103, 46]; | |
24 | |
25 void registerTests(TestSuite suite) { | |
26 register("testCodepointsToString", testCodepointsToString, suite); | |
27 register("testStringToCodepoints", testStringToCodepoints, suite); | |
28 register("testEmptyCodepointsToString", testEmptyCodepointsToString, suite); | |
29 register("testEmptyStringToCodepoints", testEmptyStringToCodepoints, suite); | |
30 } | |
31 | |
32 void testStringToCodepoints() { | |
33 Expect.listEquals(testCodepoints, stringToCodepoints(testPhrase)); | |
34 } | |
35 | |
36 void testCodepointsToString() { | |
37 Expect.stringEquals(testPhrase, codepointsToString(testCodepoints)); | |
38 } | |
39 | |
40 void testEmptyCodepointsToString() { | |
41 Expect.stringEquals("", codepointsToString(<int>[])); | |
42 } | |
43 | |
44 void testEmptyStringToCodepoints() { | |
45 Expect.listEquals([], stringToCodepoints("")); | |
46 } | |
47 } | |
OLD | NEW |