Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: tests/standalone_2/float_array_static_test.dart

Issue 2984363004: Migrate first block of tests in standalone to standalone_2 (Closed)
Patch Set: Address review comments. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone_2/fields_may_be_reset_test.dart ('k') | tests/standalone_2/float_array_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone_2/float_array_static_test.dart
diff --git a/tests/standalone_2/float_array_static_test.dart b/tests/standalone_2/float_array_static_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..70c415a8342664b1f22c443377d4b70505c91e0a
--- /dev/null
+++ b/tests/standalone_2/float_array_static_test.dart
@@ -0,0 +1,64 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// Dart test program for testing native float arrays.
+
+// VMOptions=--optimization_counter_threshold=10 --no-background_compilation
+
+// Library tag to be able to run in html test framework.
+library FloatArrayTest;
+
+import "package:expect/expect.dart";
+import 'dart:typed_data';
+
+void testIndexOf32() {
+ var list = new Float32List(10);
+ for (int i = 0; i < list.length; i++) {
+ list[i] = i + 10.0;
+ }
+ /*@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.
+ /*@compile-error=unspecified*/ Expect.equals(5, list.indexOf(15));
+ /*@compile-error=unspecified*/ Expect.equals(9, list.indexOf(19));
+ /*@compile-error=unspecified*/ Expect.equals(-1, list.indexOf(20));
+}
+
+void testBadValues32() {
+ var list = new Float32List(10);
+ list[0] = 2.0;
+ 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.
+ /*@compile-error=unspecified*/ list[0] = 2;
+ });
+ Expect.throws(() {
+ /*@compile-error=unspecified*/ list[0] = "hello";
+ });
+}
+
+void testIndexOf64() {
+ var list = new Float64List(10);
+ for (int i = 0; i < list.length; i++) {
+ list[i] = i + 10.0;
+ }
+ /*@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.
+ /*@compile-error=unspecified*/ Expect.equals(5, list.indexOf(15));
+ /*@compile-error=unspecified*/ Expect.equals(9, list.indexOf(19));
+ /*@compile-error=unspecified*/ Expect.equals(-1, list.indexOf(20));
+}
+
+void testBadValues64() {
+ var list = new Float64List(10);
+ list[0] = 2.0;
+ Expect.throws(() {
bkonyi 2017/07/28 22:05:02 See above.
siva 2017/07/28 22:34:27 Done.
+ /*@compile-error=unspecified*/ list[0] = 2;
+ });
+ Expect.throws(() {
+ /*@compile-error=unspecified*/ list[0] = "hello";
+ });
+}
+
+main() {
+ testIndexOf32();
+ testIndexOf64();
+ testBadValues32();
+ testBadValues64();
+}
« no previous file with comments | « tests/standalone_2/fields_may_be_reset_test.dart ('k') | tests/standalone_2/float_array_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698