| 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 // Dart test program for testing native float arrays. | 5 // Dart test program for testing native float arrays. |
| 6 | 6 |
| 7 // Library tag to be able to run in html test framework. | 7 // Library tag to be able to run in html test framework. |
| 8 #library("FloatArrayTest.dart"); | 8 #library("FloatArrayTest.dart"); |
| 9 | 9 |
| 10 #import('dart:scalarlist'); | 10 #import('dart:scalarlist'); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 Expect.equals(20, floatArray[0]); | 43 Expect.equals(20, floatArray[0]); |
| 44 Expect.equals(8, floatArray[1]); | 44 Expect.equals(8, floatArray[1]); |
| 45 Expect.equals(9, floatArray[2]); | 45 Expect.equals(9, floatArray[2]); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void testIndexOutOfRange() { | 48 void testIndexOutOfRange() { |
| 49 Float32List floatArray = new Float32List(3); | 49 Float32List floatArray = new Float32List(3); |
| 50 List<num> list = const [0.0, 1.0, 2.0, 3.0]; | 50 List<num> list = const [0.0, 1.0, 2.0, 3.0]; |
| 51 | 51 |
| 52 Expect.throws(() { | 52 Expect.throws(() { |
| 53 floatArray[5] = 2.0; |
| 54 }); |
| 55 Expect.throws(() { |
| 53 floatArray.setRange(0, 4, list); | 56 floatArray.setRange(0, 4, list); |
| 54 }); | 57 }); |
| 55 | 58 |
| 56 Expect.throws(() { | 59 Expect.throws(() { |
| 57 floatArray.setRange(3, 1, list); | 60 floatArray.setRange(3, 1, list); |
| 58 }); | 61 }); |
| 59 } | 62 } |
| 60 | 63 |
| 61 void testIndexOf() { | 64 void testIndexOf() { |
| 62 var list = new Float32List(10); | 65 var list = new Float32List(10); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 79 } | 82 } |
| 80 | 83 |
| 81 main() { | 84 main() { |
| 82 for (int i = 0; i < 2000; i++) { | 85 for (int i = 0; i < 2000; i++) { |
| 83 testCreateFloatArray(); | 86 testCreateFloatArray(); |
| 84 testSetRange(); | 87 testSetRange(); |
| 85 testIndexOutOfRange(); | 88 testIndexOutOfRange(); |
| 86 testIndexOf(); | 89 testIndexOf(); |
| 87 } | 90 } |
| 88 } | 91 } |
| OLD | NEW |