| 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 library TypedArrays4Test; | |
| 6 import 'package:unittest/unittest.dart'; | |
| 7 import 'package:unittest/html_config.dart'; | |
| 8 import 'dart:html'; | 5 import 'dart:html'; |
| 9 import 'dart:typed_data'; | 6 import 'dart:typed_data'; |
| 10 | 7 |
| 8 import 'package:expect/minitest.dart'; |
| 9 |
| 11 main() { | 10 main() { |
| 12 useHtmlConfiguration(); | |
| 13 | |
| 14 // Only perform tests if ArrayBuffer is supported. | 11 // Only perform tests if ArrayBuffer is supported. |
| 15 if (!Platform.supportsTypedData) { | 12 if (!Platform.supportsTypedData) { |
| 16 return; | 13 return; |
| 17 } | 14 } |
| 18 | 15 |
| 19 test('indexOf_dynamic', () { | 16 test('indexOf_dynamic', () { |
| 20 var a1 = new Uint8List(1024); | 17 var a1 = new Uint8List(1024); |
| 21 for (int i = 0; i < a1.length; i++) { | 18 for (int i = 0; i < a1.length; i++) { |
| 22 a1[i] = i; | 19 a1[i] = i; |
| 23 } | 20 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 39 | 36 |
| 40 expect(a1.indexOf(50), 50); | 37 expect(a1.indexOf(50), 50); |
| 41 expect(a1.indexOf(50, 50), 50); | 38 expect(a1.indexOf(50, 50), 50); |
| 42 expect(a1.indexOf(50, 51), 256 + 50); | 39 expect(a1.indexOf(50, 51), 256 + 50); |
| 43 | 40 |
| 44 expect(a1.lastIndexOf(50), 768 + 50); | 41 expect(a1.lastIndexOf(50), 768 + 50); |
| 45 expect(a1.lastIndexOf(50, 768 + 50), 768 + 50); | 42 expect(a1.lastIndexOf(50, 768 + 50), 768 + 50); |
| 46 expect(a1.lastIndexOf(50, 768 + 50 - 1), 512 + 50); | 43 expect(a1.lastIndexOf(50, 768 + 50 - 1), 512 + 50); |
| 47 }); | 44 }); |
| 48 } | 45 } |
| OLD | NEW |