| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "dart:typed_data"; | 6 import "dart:typed_data"; |
| 7 | 7 |
| 8 main() { | 8 main() { |
| 9 iter(count, [values]) => values is List | 9 iter(count, [values]) => values is List |
| 10 ? new Iterable.generate(count, (x) => values[x]) | 10 ? new Iterable.generate(count, (x) => values[x]) |
| 11 : new Iterable.generate(count, (x) => values); | 11 : new Iterable.generate(count, (x) => values); |
| 12 test(expect, iter, [start = 0, end]) { | 12 test(expect, iter, [start = 0, end]) { |
| 13 var actual = new String.fromCharCodes(iter, start, end); | 13 var actual = new String.fromCharCodes(iter, start, end); |
| 14 Expect.equals(expect, actual); | 14 Expect.equals(expect, actual); |
| 15 } | 15 } |
| 16 |
| 16 testThrows(iterable, [start = 0, end]) { | 17 testThrows(iterable, [start = 0, end]) { |
| 17 Expect.throws(() { new String.fromCharCodes(iterable, start, end); }); | 18 Expect.throws(() { |
| 19 new String.fromCharCodes(iterable, start, end); |
| 20 }); |
| 18 } | 21 } |
| 19 | 22 |
| 20 test("", iter(0)); | 23 test("", iter(0)); |
| 21 test("", []); | 24 test("", []); |
| 22 test("", const []); | 25 test("", const []); |
| 23 test("", new List(0)); | 26 test("", new List(0)); |
| 24 test("", new Uint8List(0)); | 27 test("", new Uint8List(0)); |
| 25 test("", new Uint16List(0)); | 28 test("", new Uint16List(0)); |
| 26 test("", new Uint32List(0)); | 29 test("", new Uint32List(0)); |
| 27 test("", "".codeUnits); | 30 test("", "".codeUnits); |
| 28 | 31 |
| 29 test("\x00", iter(1, 0)); | 32 test("\x00", iter(1, 0)); |
| 30 test("\x00", [0]); | 33 test("\x00", [0]); |
| 31 test("\x00", const [0]); | 34 test("\x00", const [0]); |
| 32 test("\x00", new List(1)..[0]=0); | 35 test("\x00", new List(1)..[0] = 0); |
| 33 test("\x00", new Uint8List(1)); | 36 test("\x00", new Uint8List(1)); |
| 34 test("\x00", new Uint16List(1)); | 37 test("\x00", new Uint16List(1)); |
| 35 test("\x00", new Uint32List(1)); | 38 test("\x00", new Uint32List(1)); |
| 36 test("\x00", "\x00".codeUnits); | 39 test("\x00", "\x00".codeUnits); |
| 37 | 40 |
| 38 test("\xff", iter(1, 255)); | 41 test("\xff", iter(1, 255)); |
| 39 test("\xFF", [255]); | 42 test("\xFF", [255]); |
| 40 test("\xFF", const [255]); | 43 test("\xFF", const [255]); |
| 41 test("\xFF", new List(1)..[0]=255); | 44 test("\xFF", new List(1)..[0] = 255); |
| 42 test("\xFF", new Uint8List(1)..[0] = 255); | 45 test("\xFF", new Uint8List(1)..[0] = 255); |
| 43 test("\xFF", new Uint16List(1)..[0] = 255); | 46 test("\xFF", new Uint16List(1)..[0] = 255); |
| 44 test("\xFF", new Uint32List(1)..[0] = 255); | 47 test("\xFF", new Uint32List(1)..[0] = 255); |
| 45 test("\xFF", "\xFF".codeUnits); | 48 test("\xFF", "\xFF".codeUnits); |
| 46 | 49 |
| 47 test("\u0100", iter(1, 256)); | 50 test("\u0100", iter(1, 256)); |
| 48 test("\u0100", [256]); | 51 test("\u0100", [256]); |
| 49 test("\u0100", const [256]); | 52 test("\u0100", const [256]); |
| 50 test("\u0100", new List(1)..[0]=256); | 53 test("\u0100", new List(1)..[0] = 256); |
| 51 test("\u0100", new Uint16List(1)..[0] = 256); | 54 test("\u0100", new Uint16List(1)..[0] = 256); |
| 52 test("\u0100", new Uint32List(1)..[0] = 256); | 55 test("\u0100", new Uint32List(1)..[0] = 256); |
| 53 test("\u0100", "\u0100".codeUnits); | 56 test("\u0100", "\u0100".codeUnits); |
| 54 | 57 |
| 55 test("\uffff", iter(1, 65535)); | 58 test("\uffff", iter(1, 65535)); |
| 56 test("\uffff", [65535]); | 59 test("\uffff", [65535]); |
| 57 test("\uffff", const [65535]); | 60 test("\uffff", const [65535]); |
| 58 test("\uffff", new List(1)..[0]=65535); | 61 test("\uffff", new List(1)..[0] = 65535); |
| 59 test("\uffff", new Uint16List(1)..[0] = 65535); | 62 test("\uffff", new Uint16List(1)..[0] = 65535); |
| 60 test("\uffff", new Uint32List(1)..[0] = 65535); | 63 test("\uffff", new Uint32List(1)..[0] = 65535); |
| 61 test("\uffff", "\uffff".codeUnits); | 64 test("\uffff", "\uffff".codeUnits); |
| 62 | 65 |
| 63 test("\u{10000}", iter(1, 65536)); | 66 test("\u{10000}", iter(1, 65536)); |
| 64 test("\u{10000}", [65536]); | 67 test("\u{10000}", [65536]); |
| 65 test("\u{10000}", const [65536]); | 68 test("\u{10000}", const [65536]); |
| 66 test("\u{10000}", new List(1)..[0]=65536); | 69 test("\u{10000}", new List(1)..[0] = 65536); |
| 67 test("\u{10000}", new Uint32List(1)..[0]=65536); | 70 test("\u{10000}", new Uint32List(1)..[0] = 65536); |
| 68 test("\u{10000}", "\u{10000}".codeUnits); | 71 test("\u{10000}", "\u{10000}".codeUnits); |
| 69 | 72 |
| 70 test("\u{10FFFF}", iter(1, 0x10FFFF)); | 73 test("\u{10FFFF}", iter(1, 0x10FFFF)); |
| 71 test("\u{10FFFF}", [0x10FFFF]); | 74 test("\u{10FFFF}", [0x10FFFF]); |
| 72 test("\u{10FFFF}", const [0x10FFFF]); | 75 test("\u{10FFFF}", const [0x10FFFF]); |
| 73 test("\u{10FFFF}", new List(1)..[0]=0x10FFFF); | 76 test("\u{10FFFF}", new List(1)..[0] = 0x10FFFF); |
| 74 test("\u{10FFFF}", new Uint32List(1)..[0] = 0x10FFFF); | 77 test("\u{10FFFF}", new Uint32List(1)..[0] = 0x10FFFF); |
| 75 | 78 |
| 76 test("\u{10ffff}", iter(2, [0xDBFF, 0xDFFF])); | 79 test("\u{10ffff}", iter(2, [0xDBFF, 0xDFFF])); |
| 77 test("\u{10ffff}", [0xDBFF, 0xDFFF]); | 80 test("\u{10ffff}", [0xDBFF, 0xDFFF]); |
| 78 test("\u{10ffff}", const [0xDBFF, 0xDFFF]); | 81 test("\u{10ffff}", const [0xDBFF, 0xDFFF]); |
| 79 test("\u{10ffff}", new List(2)..[0] = 0xDBFF..[1] = 0xDFFF); | 82 test( |
| 80 test("\u{10ffff}", new Uint16List(2)..[0] = 0xDBFF..[1] = 0xDFFF); | 83 "\u{10ffff}", |
| 81 test("\u{10ffff}", new Uint32List(2)..[0] = 0xDBFF..[1] = 0xDFFF); | 84 new List(2) |
| 85 ..[0] = 0xDBFF |
| 86 ..[1] = 0xDFFF); |
| 87 test( |
| 88 "\u{10ffff}", |
| 89 new Uint16List(2) |
| 90 ..[0] = 0xDBFF |
| 91 ..[1] = 0xDFFF); |
| 92 test( |
| 93 "\u{10ffff}", |
| 94 new Uint32List(2) |
| 95 ..[0] = 0xDBFF |
| 96 ..[1] = 0xDFFF); |
| 82 test("\u{10FFFF}", "\u{10FFFF}".codeUnits); | 97 test("\u{10FFFF}", "\u{10FFFF}".codeUnits); |
| 83 | 98 |
| 84 var leadSurrogate = "\u{10ffff}"[0]; | 99 var leadSurrogate = "\u{10ffff}"[0]; |
| 85 test(leadSurrogate, iter(1, 0xDBFF)); | 100 test(leadSurrogate, iter(1, 0xDBFF)); |
| 86 test(leadSurrogate, [0xDBFF]); | 101 test(leadSurrogate, [0xDBFF]); |
| 87 test(leadSurrogate, const [0xDBFF]); | 102 test(leadSurrogate, const [0xDBFF]); |
| 88 test(leadSurrogate, new List(1)..[0]=0xDBFF); | 103 test(leadSurrogate, new List(1)..[0] = 0xDBFF); |
| 89 test(leadSurrogate, new Uint16List(1)..[0] = 0xDBFF); | 104 test(leadSurrogate, new Uint16List(1)..[0] = 0xDBFF); |
| 90 test(leadSurrogate, new Uint32List(1)..[0] = 0xDBFF); | 105 test(leadSurrogate, new Uint32List(1)..[0] = 0xDBFF); |
| 91 test(leadSurrogate, leadSurrogate.codeUnits); | 106 test(leadSurrogate, leadSurrogate.codeUnits); |
| 92 | 107 |
| 93 var tailSurrogate = "\u{10ffff}"[1]; | 108 var tailSurrogate = "\u{10ffff}"[1]; |
| 94 test(tailSurrogate, iter(1, 0xDFFF)); | 109 test(tailSurrogate, iter(1, 0xDFFF)); |
| 95 test(tailSurrogate, [0xDFFF]); | 110 test(tailSurrogate, [0xDFFF]); |
| 96 test(tailSurrogate, const [0xDFFF]); | 111 test(tailSurrogate, const [0xDFFF]); |
| 97 test(tailSurrogate, new List(1)..[0]=0xDFFF); | 112 test(tailSurrogate, new List(1)..[0] = 0xDFFF); |
| 98 test(tailSurrogate, new Uint16List(1)..[0] = 0xDFFF); | 113 test(tailSurrogate, new Uint16List(1)..[0] = 0xDFFF); |
| 99 test(tailSurrogate, new Uint32List(1)..[0] = 0xDFFF); | 114 test(tailSurrogate, new Uint32List(1)..[0] = 0xDFFF); |
| 100 test(tailSurrogate, tailSurrogate.codeUnits); | 115 test(tailSurrogate, tailSurrogate.codeUnits); |
| 101 | 116 |
| 102 testThrows(null); | 117 testThrows(null); |
| 103 testThrows("not an iterable"); | 118 testThrows("not an iterable"); |
| 104 testThrows(42); | 119 testThrows(42); |
| 105 testThrows([-1]); | 120 testThrows([-1]); |
| 106 testThrows(new List(1)..[0] = -1); | 121 testThrows(new List(1)..[0] = -1); |
| 107 testThrows(const [-1]); | 122 testThrows(const [-1]); |
| 108 testThrows(new Int8List(1)..[0] = -1); | 123 testThrows(new Int8List(1)..[0] = -1); |
| 109 testThrows(new Int16List(1)..[0] = -1); | 124 testThrows(new Int16List(1)..[0] = -1); |
| 110 testThrows(new Int32List(1)..[0] = -1); | 125 testThrows(new Int32List(1)..[0] = -1); |
| 111 testThrows([0x110000]); | 126 testThrows([0x110000]); |
| 112 testThrows(new List(1)..[0] = 0x110000); | 127 testThrows(new List(1)..[0] = 0x110000); |
| 113 testThrows(const [0x110000]); | 128 testThrows(const [0x110000]); |
| 114 testThrows(new Int32List(1)..[0] = 0x110000); | 129 testThrows(new Int32List(1)..[0] = 0x110000); |
| 115 | 130 |
| 116 // Check start/end | 131 // Check start/end |
| 117 var list = const[0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48]; | 132 var list = const [0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48]; |
| 118 for (var iterable in [ | 133 for (var iterable in [ |
| 119 iter(list.length, list), | 134 iter(list.length, list), |
| 120 list.toList(growable: true), | 135 list.toList(growable: true), |
| 121 list.toList(growable: false), | 136 list.toList(growable: false), |
| 122 list, | 137 list, |
| 123 new Uint8List(8)..setRange(0, 8, list), | 138 new Uint8List(8)..setRange(0, 8, list), |
| 124 new Uint16List(8)..setRange(0, 8, list), | 139 new Uint16List(8)..setRange(0, 8, list), |
| 125 new Uint32List(8)..setRange(0, 8, list), | 140 new Uint32List(8)..setRange(0, 8, list), |
| 126 "ABCDEFGH".codeUnits, | 141 "ABCDEFGH".codeUnits, |
| 127 ]) { | 142 ]) { |
| 128 test("ABCDEFGH", iterable); | 143 test("ABCDEFGH", iterable); |
| 129 // start varies, end is null. | 144 // start varies, end is null. |
| 130 test("ABCDEFGH", iterable, 0); | 145 test("ABCDEFGH", iterable, 0); |
| 131 test("BCDEFGH", iterable, 1); | 146 test("BCDEFGH", iterable, 1); |
| 132 test("H", iterable, 7); | 147 test("H", iterable, 7); |
| 133 test("", iterable, 8); | 148 test("", iterable, 8); |
| 134 // start = 0, end varies. | 149 // start = 0, end varies. |
| 135 test("ABCDEFGH", iterable, 0); | 150 test("ABCDEFGH", iterable, 0); |
| 136 test("A", iterable, 0, 1); | 151 test("A", iterable, 0, 1); |
| 137 test("AB", iterable, 0, 2); | 152 test("AB", iterable, 0, 2); |
| 138 test("ABCDEFG", iterable, 0, 7); | 153 test("ABCDEFG", iterable, 0, 7); |
| 139 test("ABCDEFGH", iterable, 0, 8); | 154 test("ABCDEFGH", iterable, 0, 8); |
| 140 test("", iterable, 0, 0); | 155 test("", iterable, 0, 0); |
| 141 // Both varying. | 156 // Both varying. |
| 142 test("ABCDEFGH", iterable, 0, 8); | 157 test("ABCDEFGH", iterable, 0, 8); |
| 143 test("AB", iterable, 0, 2); | 158 test("AB", iterable, 0, 2); |
| 144 test("GH", iterable, 6, 8); | 159 test("GH", iterable, 6, 8); |
| 145 test("DE", iterable, 3, 5); | 160 test("DE", iterable, 3, 5); |
| 146 test("", iterable, 3, 3); | 161 test("", iterable, 3, 3); |
| 147 } | 162 } |
| 148 // Can split surrogates in input, but not a single big code point. | 163 // Can split surrogates in input, but not a single big code point. |
| 149 test(leadSurrogate, [0xDBFF, 0xDFFF], 0, 1); | 164 test(leadSurrogate, [0xDBFF, 0xDFFF], 0, 1); |
| 150 test(tailSurrogate, [0xDBFF, 0xDFFF], 1); | 165 test(tailSurrogate, [0xDBFF, 0xDFFF], 1); |
| 151 test("\u{10FFFF}", [0x10FFFF], 0, 1); | 166 test("\u{10FFFF}", [0x10FFFF], 0, 1); |
| 152 | 167 |
| 153 void testThrowsRange(iterable, [start = 0, end]) { | 168 void testThrowsRange(iterable, [start = 0, end]) { |
| 154 Expect.throws(() => new String.fromCharCodes(iterable, start, end), | 169 Expect.throws(() => new String.fromCharCodes(iterable, start, end), |
| 155 (e) => e is RangeError); | 170 (e) => e is RangeError); |
| 156 } | 171 } |
| 157 | 172 |
| 158 // Test varying slices of the code units of a string. | 173 // Test varying slices of the code units of a string. |
| 159 testSubstring(string) { | 174 testSubstring(string) { |
| 160 var codes = string.codeUnits; | 175 var codes = string.codeUnits; |
| 161 int length = string.length; | 176 int length = string.length; |
| 162 for (var iterable in [ | 177 for (var iterable in [ |
| 163 iter(length, codes), | 178 iter(length, codes), |
| 164 codes.toList(growable: true), | 179 codes.toList(growable: true), |
| 165 codes.toList(growable: false), | 180 codes.toList(growable: false), |
| 166 new Uint16List(length)..setRange(0, length, codes), | 181 new Uint16List(length)..setRange(0, length, codes), |
| 167 new Int32List(length)..setRange(0, length, codes), | 182 new Int32List(length)..setRange(0, length, codes), |
| 168 new Uint32List(length)..setRange(0, length, codes), | 183 new Uint32List(length)..setRange(0, length, codes), |
| 169 codes, | 184 codes, |
| 170 ]) { | 185 ]) { |
| 171 var newString = new String.fromCharCodes(iterable); | 186 var newString = new String.fromCharCodes(iterable); |
| 172 Expect.equals(string, newString); | 187 Expect.equals(string, newString); |
| 173 for (int i = 0; i < length; i = i * 2 + 1) { | 188 for (int i = 0; i < length; i = i * 2 + 1) { |
| 174 test(string.substring(i), iterable, i); | 189 test(string.substring(i), iterable, i); |
| 175 test(string.substring(0, i), iterable, 0, i); | 190 test(string.substring(0, i), iterable, 0, i); |
| 176 for (int j = 0; i + j < length; j = j * 2 + 1) { | 191 for (int j = 0; i + j < length; j = j * 2 + 1) { |
| 177 test(string.substring(i, i + j), iterable, i, i + j); | 192 test(string.substring(i, i + j), iterable, i, i + j); |
| 178 } | 193 } |
| 179 } | 194 } |
| 180 | 195 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 194 testSubstring("\x00" * 357); | 209 testSubstring("\x00" * 357); |
| 195 // length > 128 and non-ASCII. | 210 // length > 128 and non-ASCII. |
| 196 testSubstring("\uFFFD\uFFFE\u{10000}\u{10ffff}c\x00" * 37); | 211 testSubstring("\uFFFD\uFFFE\u{10000}\u{10ffff}c\x00" * 37); |
| 197 | 212 |
| 198 // Large List. | 213 // Large List. |
| 199 var megaList = ("abcde" * 200000).codeUnits.toList(); | 214 var megaList = ("abcde" * 200000).codeUnits.toList(); |
| 200 test("abcde" * 199998, megaList, 5, 999995); | 215 test("abcde" * 199998, megaList, 5, 999995); |
| 201 // Large Uint8List. | 216 // Large Uint8List. |
| 202 test("abcde" * 199998, new Uint8List.fromList(megaList), 5, 999995); | 217 test("abcde" * 199998, new Uint8List.fromList(megaList), 5, 999995); |
| 203 | 218 |
| 204 const cLatin1 = const [0x00, 0xff]; | 219 const cLatin1 = const [0x00, 0xff]; |
| 205 const cUtf16 = const [0x00, 0xffff, 0xdfff, 0xdbff, 0xdfff, 0xdbff]; | 220 const cUtf16 = const [0x00, 0xffff, 0xdfff, 0xdbff, 0xdfff, 0xdbff]; |
| 206 const cCodepoints = const [0x00, 0xffff, 0xdfff, 0x10ffff, 0xdbff]; | 221 const cCodepoints = const [0x00, 0xffff, 0xdfff, 0x10ffff, 0xdbff]; |
| 207 List gLatin1 = cLatin1.toList(growable: true); | 222 List gLatin1 = cLatin1.toList(growable: true); |
| 208 List gUtf16 = cUtf16.toList(growable: true); | 223 List gUtf16 = cUtf16.toList(growable: true); |
| 209 List gCodepoints = cCodepoints.toList(growable: true); | 224 List gCodepoints = cCodepoints.toList(growable: true); |
| 210 List fLatin1 = cLatin1.toList(growable: false); | 225 List fLatin1 = cLatin1.toList(growable: false); |
| 211 List fUtf16 = cUtf16.toList(growable: false); | 226 List fUtf16 = cUtf16.toList(growable: false); |
| 212 List fCodepoints = cCodepoints.toList(growable: false); | 227 List fCodepoints = cCodepoints.toList(growable: false); |
| 213 Uint8List bLatin1 = new Uint8List(2)..setRange(0, 2, cLatin1); | 228 Uint8List bLatin1 = new Uint8List(2)..setRange(0, 2, cLatin1); |
| 214 Uint16List wLatin1 = new Uint16List(2)..setRange(0, 2, cLatin1); | 229 Uint16List wLatin1 = new Uint16List(2)..setRange(0, 2, cLatin1); |
| 215 Uint16List wUtf16 = new Uint16List(6)..setRange(0, 6, cUtf16); | 230 Uint16List wUtf16 = new Uint16List(6)..setRange(0, 6, cUtf16); |
| 216 Uint32List lLatin1 = new Uint32List(2)..setRange(0, 2, cLatin1); | 231 Uint32List lLatin1 = new Uint32List(2)..setRange(0, 2, cLatin1); |
| 217 Uint32List lUtf16 = new Uint32List(6)..setRange(0, 6, cUtf16); | 232 Uint32List lUtf16 = new Uint32List(6)..setRange(0, 6, cUtf16); |
| 218 Uint32List lCodepoints = new Uint32List(5)..setRange(0, 5, cCodepoints); | 233 Uint32List lCodepoints = new Uint32List(5)..setRange(0, 5, cCodepoints); |
| 219 Uint8List bvLatin1 = new Uint8List.view(bLatin1.buffer); | 234 Uint8List bvLatin1 = new Uint8List.view(bLatin1.buffer); |
| 220 Uint16List wvLatin1 = new Uint16List.view(wLatin1.buffer); | 235 Uint16List wvLatin1 = new Uint16List.view(wLatin1.buffer); |
| 221 Uint16List wvUtf16 = new Uint16List.view(wUtf16.buffer); | 236 Uint16List wvUtf16 = new Uint16List.view(wUtf16.buffer); |
| 222 Uint32List lvLatin1 = new Uint32List.view(lLatin1.buffer); | 237 Uint32List lvLatin1 = new Uint32List.view(lLatin1.buffer); |
| 223 Uint32List lvUtf16 = new Uint32List.view(lUtf16.buffer); | 238 Uint32List lvUtf16 = new Uint32List.view(lUtf16.buffer); |
| 224 Uint32List lvCodepoints = new Uint32List.view(lCodepoints.buffer); | 239 Uint32List lvCodepoints = new Uint32List.view(lCodepoints.buffer); |
| 225 var buffer = new Uint8List(200).buffer; | 240 var buffer = new Uint8List(200).buffer; |
| 226 Uint8List bbLatin1 = | 241 Uint8List bbLatin1 = new Uint8List.view(buffer, 3, 2)..setAll(0, bLatin1); |
| 227 new Uint8List.view(buffer, 3, 2)..setAll(0, bLatin1); | 242 Uint16List wbLatin1 = new Uint16List.view(buffer, 8, 2)..setAll(0, wLatin1); |
| 228 Uint16List wbLatin1 = | 243 Uint16List wbUtf16 = new Uint16List.view(buffer, 16, 6)..setAll(0, wUtf16); |
| 229 new Uint16List.view(buffer, 8, 2)..setAll(0, wLatin1); | 244 Uint32List lbLatin1 = new Uint32List.view(buffer, 32, 2)..setAll(0, lLatin1); |
| 230 Uint16List wbUtf16 = | 245 Uint32List lbUtf16 = new Uint32List.view(buffer, 64, 6)..setAll(0, lUtf16); |
| 231 new Uint16List.view(buffer, 16, 6)..setAll(0, wUtf16); | 246 Uint32List lbCodepoints = new Uint32List.view(buffer, 128, 5) |
| 232 Uint32List lbLatin1 = | 247 ..setAll(0, lCodepoints); |
| 233 new Uint32List.view(buffer, 32, 2)..setAll(0, lLatin1); | |
| 234 Uint32List lbUtf16 = | |
| 235 new Uint32List.view(buffer, 64, 6)..setAll(0, lUtf16); | |
| 236 Uint32List lbCodepoints = | |
| 237 new Uint32List.view(buffer, 128, 5)..setAll(0, lCodepoints); | |
| 238 | 248 |
| 239 String sLatin1 = "\x00\xff"; | 249 String sLatin1 = "\x00\xff"; |
| 240 String sUnicode = | 250 String sUnicode = |
| 241 "\x00\uffff$tailSurrogate$leadSurrogate$tailSurrogate$leadSurrogate"; | 251 "\x00\uffff$tailSurrogate$leadSurrogate$tailSurrogate$leadSurrogate"; |
| 242 for (int i = 0; i < 2; i++) { | 252 for (int i = 0; i < 2; i++) { |
| 243 for (int j = i + 1; j < 2; j++) { | 253 for (int j = i + 1; j < 2; j++) { |
| 244 test(sLatin1.substring(i, j), cLatin1, i, j); | 254 test(sLatin1.substring(i, j), cLatin1, i, j); |
| 245 test(sLatin1.substring(i, j), gLatin1, i, j); | 255 test(sLatin1.substring(i, j), gLatin1, i, j); |
| 246 test(sLatin1.substring(i, j), fLatin1, i, j); | 256 test(sLatin1.substring(i, j), fLatin1, i, j); |
| 247 test(sLatin1.substring(i, j), bLatin1, i, j); | 257 test(sLatin1.substring(i, j), bLatin1, i, j); |
| 248 test(sLatin1.substring(i, j), wLatin1, i, j); | 258 test(sLatin1.substring(i, j), wLatin1, i, j); |
| 249 test(sLatin1.substring(i, j), lLatin1, i, j); | 259 test(sLatin1.substring(i, j), lLatin1, i, j); |
| 250 test(sLatin1.substring(i, j), bvLatin1, i, j); | 260 test(sLatin1.substring(i, j), bvLatin1, i, j); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 273 int stringEnd = j < 4 ? j : j + 1; | 283 int stringEnd = j < 4 ? j : j + 1; |
| 274 test(sUnicode.substring(i, stringEnd), cCodepoints, i, j); | 284 test(sUnicode.substring(i, stringEnd), cCodepoints, i, j); |
| 275 test(sUnicode.substring(i, stringEnd), gCodepoints, i, j); | 285 test(sUnicode.substring(i, stringEnd), gCodepoints, i, j); |
| 276 test(sUnicode.substring(i, stringEnd), fCodepoints, i, j); | 286 test(sUnicode.substring(i, stringEnd), fCodepoints, i, j); |
| 277 test(sUnicode.substring(i, stringEnd), lCodepoints, i, j); | 287 test(sUnicode.substring(i, stringEnd), lCodepoints, i, j); |
| 278 test(sUnicode.substring(i, stringEnd), lvCodepoints, i, j); | 288 test(sUnicode.substring(i, stringEnd), lvCodepoints, i, j); |
| 279 test(sUnicode.substring(i, stringEnd), lbCodepoints, i, j); | 289 test(sUnicode.substring(i, stringEnd), lbCodepoints, i, j); |
| 280 } | 290 } |
| 281 } | 291 } |
| 282 } | 292 } |
| OLD | NEW |