Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 // | |
| 5 // Dart test program for testing native float arrays. | |
| 6 | |
| 7 // VMOptions=--optimization_counter_threshold=10 --no-background_compilation | |
| 8 | |
| 9 // Library tag to be able to run in html test framework. | |
| 10 library FloatArrayTest; | |
| 11 | |
| 12 import "package:expect/expect.dart"; | |
| 13 import 'dart:typed_data'; | |
| 14 | |
| 15 void testIndexOf32() { | |
| 16 var list = new Float32List(10); | |
| 17 for (int i = 0; i < list.length; i++) { | |
| 18 list[i] = i + 10.0; | |
| 19 } | |
| 20 /*@compile-error=unspecified*/ Expect.equals(0, list.indexOf(10)); | |
|
bkonyi
2017/07/28 22:05:02
I don't think you need Expect.equals(...), since j
siva
2017/07/28 22:34:27
True but using just list.indexOf(10) would cause a
bkonyi
2017/07/28 22:36:09
Fair enough. Don't worry about it then.
| |
| 21 /*@compile-error=unspecified*/ Expect.equals(5, list.indexOf(15)); | |
| 22 /*@compile-error=unspecified*/ Expect.equals(9, list.indexOf(19)); | |
| 23 /*@compile-error=unspecified*/ Expect.equals(-1, list.indexOf(20)); | |
| 24 } | |
| 25 | |
| 26 void testBadValues32() { | |
| 27 var list = new Float32List(10); | |
| 28 list[0] = 2.0; | |
| 29 Expect.throws(() { | |
|
bkonyi
2017/07/28 22:05:02
You can remove the Expect.throws(...) since these
siva
2017/07/28 22:34:27
Done.
| |
| 30 /*@compile-error=unspecified*/ list[0] = 2; | |
| 31 }); | |
| 32 Expect.throws(() { | |
| 33 /*@compile-error=unspecified*/ list[0] = "hello"; | |
| 34 }); | |
| 35 } | |
| 36 | |
| 37 void testIndexOf64() { | |
| 38 var list = new Float64List(10); | |
| 39 for (int i = 0; i < list.length; i++) { | |
| 40 list[i] = i + 10.0; | |
| 41 } | |
| 42 /*@compile-error=unspecified*/ Expect.equals(0, list.indexOf(10)); | |
|
bkonyi
2017/07/28 22:05:02
See above.
siva
2017/07/28 22:34:27
See reply above.
| |
| 43 /*@compile-error=unspecified*/ Expect.equals(5, list.indexOf(15)); | |
| 44 /*@compile-error=unspecified*/ Expect.equals(9, list.indexOf(19)); | |
| 45 /*@compile-error=unspecified*/ Expect.equals(-1, list.indexOf(20)); | |
| 46 } | |
| 47 | |
| 48 void testBadValues64() { | |
| 49 var list = new Float64List(10); | |
| 50 list[0] = 2.0; | |
| 51 Expect.throws(() { | |
|
bkonyi
2017/07/28 22:05:02
See above.
siva
2017/07/28 22:34:27
Done.
| |
| 52 /*@compile-error=unspecified*/ list[0] = 2; | |
| 53 }); | |
| 54 Expect.throws(() { | |
| 55 /*@compile-error=unspecified*/ list[0] = "hello"; | |
| 56 }); | |
| 57 } | |
| 58 | |
| 59 main() { | |
| 60 testIndexOf32(); | |
| 61 testIndexOf64(); | |
| 62 testBadValues32(); | |
| 63 testBadValues64(); | |
| 64 } | |
| OLD | NEW |