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

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

Issue 2989993002: fix unsound cast failures in tests (Closed)
Patch Set: fix Created 3 years, 4 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
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 [ 8 const INTER_BYTES = const [
9 0xc3, 9 0xc3,
10 0x8e, 10 0x8e,
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 const BIGGEST_3_UTF8_UNIT_BYTES = const [0xEF, 0xBF, 0xBF]; 198 const BIGGEST_3_UTF8_UNIT_BYTES = const [0xEF, 0xBF, 0xBF];
199 const BIGGEST_3_UTF8_UNIT_STRING = "\u{FFFF}"; 199 const BIGGEST_3_UTF8_UNIT_STRING = "\u{FFFF}";
200 200
201 const SMALLEST_4_UTF8_UNIT_BYTES = const [0xF0, 0x90, 0x80, 0x80]; 201 const SMALLEST_4_UTF8_UNIT_BYTES = const [0xF0, 0x90, 0x80, 0x80];
202 const SMALLEST_4_UTF8_UNIT_STRING = "\u{10000}"; 202 const SMALLEST_4_UTF8_UNIT_STRING = "\u{10000}";
203 203
204 const BIGGEST_4_UTF8_UNIT_BYTES = const [0xF4, 0x8F, 0xBF, 0xBF]; 204 const BIGGEST_4_UTF8_UNIT_BYTES = const [0xF4, 0x8F, 0xBF, 0xBF];
205 const BIGGEST_4_UTF8_UNIT_STRING = "\u{10FFFF}"; 205 const BIGGEST_4_UTF8_UNIT_STRING = "\u{10FFFF}";
206 206
207 const _TEST_PAIRS = const [ 207 const _TEST_PAIRS = const [
208 const [const [], ""], 208 const [const <int>[], ""],
209 const [INTER_BYTES, INTER_STRING], 209 const [INTER_BYTES, INTER_STRING],
210 const [BLUEBERRY_BYTES, BLUEBERRY_STRING], 210 const [BLUEBERRY_BYTES, BLUEBERRY_STRING],
211 const [SIVA_BYTES1, SIVA_STRING1], 211 const [SIVA_BYTES1, SIVA_STRING1],
212 const [SIVA_BYTES2, SIVA_STRING2], 212 const [SIVA_BYTES2, SIVA_STRING2],
213 const [BEE_BYTES, BEE_STRING], 213 const [BEE_BYTES, BEE_STRING],
214 const [DIGIT_BYTES, DIGIT_STRING], 214 const [DIGIT_BYTES, DIGIT_STRING],
215 const [ASCII_BYTES, ASCII_STRING], 215 const [ASCII_BYTES, ASCII_STRING],
216 const [BIGGEST_ASCII_BYTES, BIGGEST_ASCII_STRING], 216 const [BIGGEST_ASCII_BYTES, BIGGEST_ASCII_STRING],
217 const [SMALLEST_2_UTF8_UNIT_BYTES, SMALLEST_2_UTF8_UNIT_STRING], 217 const [SMALLEST_2_UTF8_UNIT_BYTES, SMALLEST_2_UTF8_UNIT_STRING],
218 const [BIGGEST_2_UTF8_UNIT_BYTES, BIGGEST_2_UTF8_UNIT_STRING], 218 const [BIGGEST_2_UTF8_UNIT_BYTES, BIGGEST_2_UTF8_UNIT_STRING],
219 const [SMALLEST_3_UTF8_UNIT_BYTES, SMALLEST_3_UTF8_UNIT_STRING], 219 const [SMALLEST_3_UTF8_UNIT_BYTES, SMALLEST_3_UTF8_UNIT_STRING],
220 const [BIGGEST_3_UTF8_UNIT_BYTES, BIGGEST_3_UTF8_UNIT_STRING], 220 const [BIGGEST_3_UTF8_UNIT_BYTES, BIGGEST_3_UTF8_UNIT_STRING],
221 const [SMALLEST_4_UTF8_UNIT_BYTES, SMALLEST_4_UTF8_UNIT_STRING], 221 const [SMALLEST_4_UTF8_UNIT_BYTES, SMALLEST_4_UTF8_UNIT_STRING],
222 const [BIGGEST_4_UTF8_UNIT_BYTES, BIGGEST_4_UTF8_UNIT_STRING], 222 const [BIGGEST_4_UTF8_UNIT_BYTES, BIGGEST_4_UTF8_UNIT_STRING],
223 ]; 223 ];
224 224
225 List<List> _expandTestPairs() { 225 List<List> _expandTestPairs() {
226 assert(2 == BEE_STRING.length); 226 assert(2 == BEE_STRING.length);
227 var tests = []; 227 var tests = <List>[];
228 tests.addAll(_TEST_PAIRS); 228 tests.addAll(_TEST_PAIRS);
229 tests.addAll(_TEST_PAIRS.map((test) { 229 tests.addAll(_TEST_PAIRS.map((test) {
230 var bytes = test[0]; 230 var bytes = test[0];
231 var string = test[1]; 231 var string = test[1];
232 var longBytes = []; 232 var longBytes = <int>[];
233 var longString = ""; 233 var longString = "";
234 for (int i = 0; i < 100; i++) { 234 for (int i = 0; i < 100; i++) {
235 longBytes.addAll(bytes); 235 longBytes.addAll(bytes);
236 longString += string; 236 longString += string;
237 } 237 }
238 return [longBytes, longString]; 238 return [longBytes, longString];
239 })); 239 }));
240 return tests; 240 return tests;
241 } 241 }
242 242
243 final List UNICODE_TESTS = _expandTestPairs(); 243 final List UNICODE_TESTS = _expandTestPairs();
OLDNEW
« no previous file with comments | « tests/lib_strong/convert/streamed_conversion_json_decode1_test.dart ('k') | tests/lib_strong/convert/utf82_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698