OLD | NEW |
1 // Copyright (c) 2011, 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 // Dart test program for testing native byte arrays. | 5 // Dart test program for testing native byte arrays. |
6 | 6 |
| 7 #import('dart:scalarlist'); |
| 8 |
7 void testCreateByteArray() { | 9 void testCreateByteArray() { |
8 Uint8List byteArray; | 10 Uint8List byteArray; |
9 | 11 |
10 byteArray = new Uint8List(0); | 12 byteArray = new Uint8List(0); |
11 Expect.equals(0, byteArray.length); | 13 Expect.equals(0, byteArray.length); |
12 | 14 |
13 byteArray = new Uint8List(10); | 15 byteArray = new Uint8List(10); |
14 Expect.equals(10, byteArray.length); | 16 Expect.equals(10, byteArray.length); |
15 for (int i = 0; i < 10; i++) { | 17 for (int i = 0; i < 10; i++) { |
16 Expect.equals(0, byteArray[i]); | 18 Expect.equals(0, byteArray[i]); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 76 } |
75 | 77 |
76 main() { | 78 main() { |
77 for (int i = 0; i < 2000; i++) { | 79 for (int i = 0; i < 2000; i++) { |
78 testCreateByteArray(); | 80 testCreateByteArray(); |
79 testSetRange(); | 81 testSetRange(); |
80 testIndexOutOfRange(); | 82 testIndexOutOfRange(); |
81 testIndexOf(); | 83 testIndexOf(); |
82 } | 84 } |
83 } | 85 } |
OLD | NEW |