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 tag to be able to run in html test framework. | 5 // Library tag to be able to run in html test framework. |
6 library byte_array_test; | 6 library byte_array_test; |
7 | 7 |
8 import "package:expect/expect.dart"; | |
9 import 'dart:scalarlist'; | 8 import 'dart:scalarlist'; |
10 | 9 |
11 // This test exercises optimized [] and []= operators | 10 // This test exercises optimized [] and []= operators |
12 // on byte array views. | 11 // on byte array views. |
13 class OptimizedByteArrayTest { | 12 class OptimizedByteArrayTest { |
14 static testInt8ListImpl(Int8List array) { | 13 static testInt8ListImpl(Int8List array) { |
15 Expect.isTrue(array is List<int>); | 14 Expect.isTrue(array is List<int>); |
16 Expect.equals(10, array.length); | 15 Expect.equals(10, array.length); |
17 Expect.equals(1, array.bytesPerElement()); | 16 Expect.equals(1, array.bytesPerElement()); |
18 Expect.equals(10, array.lengthInBytes()); | 17 Expect.equals(10, array.lengthInBytes()); |
(...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 testFloat32ListView(); | 2205 testFloat32ListView(); |
2207 testFloat64ListView(); | 2206 testFloat64ListView(); |
2208 } | 2207 } |
2209 } | 2208 } |
2210 | 2209 |
2211 main() { | 2210 main() { |
2212 for (var i=0; i<1000; i++) { | 2211 for (var i=0; i<1000; i++) { |
2213 OptimizedByteArrayTest.testMain(); | 2212 OptimizedByteArrayTest.testMain(); |
2214 } | 2213 } |
2215 } | 2214 } |
OLD | NEW |