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 TypedArrays3Test; | |
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('setElementsTest_dynamic', () { | 16 test('setElementsTest_dynamic', () { |
20 var a1 = new Int8List(1024); | 17 var a1 = new Int8List(1024); |
21 | 18 |
22 a1.setRange(4, 7, [0x50,0x60,0x70]); | 19 a1.setRange(4, 7, [0x50,0x60,0x70]); |
23 | 20 |
(...skipping 13 matching lines...) Expand all Loading... |
37 | 34 |
38 Uint32List a2 = new Uint32List.view(a1.buffer); | 35 Uint32List a2 = new Uint32List.view(a1.buffer); |
39 expect(a2[0], 0x00000000); | 36 expect(a2[0], 0x00000000); |
40 expect(a2[1], 0x00706050); | 37 expect(a2[1], 0x00706050); |
41 | 38 |
42 a2.setRange(2, 3, [0x01020304]); | 39 a2.setRange(2, 3, [0x01020304]); |
43 expect(a1[8], 0x04); | 40 expect(a1[8], 0x04); |
44 expect(a1[11], 0x01); | 41 expect(a1[11], 0x01); |
45 }); | 42 }); |
46 } | 43 } |
OLD | NEW |