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 typed_arrays_dataview_test; | |
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('create', () { | 16 test('create', () { |
20 var bd = new ByteData(100); | 17 var bd = new ByteData(100); |
21 expect(bd.lengthInBytes, 100); | 18 expect(bd.lengthInBytes, 100); |
22 expect(bd.offsetInBytes, 0); | 19 expect(bd.offsetInBytes, 0); |
23 | 20 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 expect(bd.getInt32(0), equals(1023)); | 80 expect(bd.getInt32(0), equals(1023)); |
84 expect(bd.getInt32(0, Endianness.BIG_ENDIAN), equals(1023)); | 81 expect(bd.getInt32(0, Endianness.BIG_ENDIAN), equals(1023)); |
85 expect(bd.getInt32(0, Endianness.LITTLE_ENDIAN), equals(-0xFD0000)); | 82 expect(bd.getInt32(0, Endianness.LITTLE_ENDIAN), equals(-0xFD0000)); |
86 | 83 |
87 expect(bd.getUint32(0), equals(1023)); | 84 expect(bd.getUint32(0), equals(1023)); |
88 expect(bd.getUint32(0, Endianness.BIG_ENDIAN), equals(1023)); | 85 expect(bd.getUint32(0, Endianness.BIG_ENDIAN), equals(1023)); |
89 expect(bd.getUint32(0, Endianness.LITTLE_ENDIAN), equals(0xFF030000)); | 86 expect(bd.getUint32(0, Endianness.LITTLE_ENDIAN), equals(0xFF030000)); |
90 }); | 87 }); |
91 | 88 |
92 } | 89 } |
OLD | NEW |