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 'dart:html'; | 5 import 'dart:html'; |
6 import 'dart:typed_data'; | 6 import 'dart:typed_data'; |
7 | 7 |
8 import 'package:expect/minitest.dart'; | 8 import 'package:expect/minitest.dart'; |
9 | 9 |
10 main() { | 10 main() { |
(...skipping 14 matching lines...) Expand all Loading... |
25 expect(() { | 25 expect(() { |
26 var a = new Float32List(10); | 26 var a = new Float32List(10); |
27 expect(a.length, 10); | 27 expect(a.length, 10); |
28 expect(a.lengthInBytes, 40); | 28 expect(a.lengthInBytes, 40); |
29 expect(a[4], 0); | 29 expect(a[4], 0); |
30 }, expectation); | 30 }, expectation); |
31 }); | 31 }); |
32 | 32 |
33 test('aliasTest', () { | 33 test('aliasTest', () { |
34 expect(() { | 34 expect(() { |
35 var a1 = new Uint8List.fromList([0,0,1,0x45]); | 35 var a1 = new Uint8List.fromList([0, 0, 1, 0x45]); |
36 var a2 = new Float32List.view(a1.buffer); | 36 var a2 = new Float32List.view(a1.buffer); |
37 | 37 |
38 expect(a1.lengthInBytes, a2.lengthInBytes); | 38 expect(a1.lengthInBytes, a2.lengthInBytes); |
39 | 39 |
40 expect(a2.length, 1); | 40 expect(a2.length, 1); |
41 | 41 |
42 // 0x45010000 = 2048+16 | 42 // 0x45010000 = 2048+16 |
43 expect(a2[0], 2048 + 16); | 43 expect(a2[0], 2048 + 16); |
44 | 44 |
45 a1[2] = 0; | 45 a1[2] = 0; |
(...skipping 16 matching lines...) Expand all Loading... |
62 expect(() { | 62 expect(() { |
63 var a = new Float32List(10); | 63 var a = new Float32List(10); |
64 expect(a, isList); | 64 expect(a, isList); |
65 expect(a, isNumList); | 65 expect(a, isNumList); |
66 expect(a, isNotStringList); | 66 expect(a, isNotStringList); |
67 }, expectation); | 67 }, expectation); |
68 }); | 68 }); |
69 } | 69 } |
70 }); | 70 }); |
71 } | 71 } |
OLD | NEW |