diff --git a/tests/corelib/compare_to2_test.dart b/tests/corelib/compare_to2_test.dart index d9973d93e5c..95b0d7fb6a2 100644 --- a/tests/corelib/compare_to2_test.dart +++ b/tests/corelib/compare_to2_test.dart @@ -4,6 +4,7 @@ // Dart test for testing Math.min and Math.max. import "package:expect/expect.dart"; +import 'package:expect/variations.dart' as v; negate(x) => -x; @@ -36,9 +37,9 @@ main() { var matrix = [ -inf, -maxFiniteAsDouble, - [minInt64, if (!webNumbers) minInt64AsDouble], - if (!webNumbers) [-maxInt64, -maxFiniteAsInt], - if (!webNumbers) -two53p1, + [minInt64, if (!v.jsNumbers) minInt64AsDouble], + if (!v.jsNumbers) [-maxInt64, -maxFiniteAsInt], + if (!v.jsNumbers) -two53p1, [-two53, -maxExactIntAsInt, -maxExactIntAsDouble], -maxNonInt, [-maxNonIntFloorAsDouble, -maxNonIntFloorAsInt], @@ -61,9 +62,9 @@ main() { [maxNonIntFloorAsDouble, maxNonIntFloorAsInt], maxNonInt, [two53, maxExactIntAsInt, maxExactIntAsDouble], - if (!webNumbers) two53p1, - [maxInt64, if (!webNumbers) maxFiniteAsInt], - if (!webNumbers) maxInt64AsDouble, + if (!v.jsNumbers) two53p1, + [maxInt64, if (!v.jsNumbers) maxFiniteAsInt], + if (!v.jsNumbers) maxInt64AsDouble, maxFiniteAsDouble, inf, [nan, mnan], diff --git a/tests/corelib/double_ceil_test.dart b/tests/corelib/double_ceil_test.dart index b5baa967690..b616f478280 100644 --- a/tests/corelib/double_ceil_test.dart +++ b/tests/corelib/double_ceil_test.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:expect/expect.dart'; +import 'package:expect/variations.dart' as v; main() { Expect.equals(0, 0.0.ceil()); @@ -24,7 +25,7 @@ main() { Expect.equals(9007199254740991, 9007199254740991.0.ceil()); Expect.equals(9007199254740992, 9007199254740992.0.ceil()); - if (webNumbers) { + if (v.jsNumbers) { Expect.equals(1.7976931348623157e+308, double.maxFinite.ceil()); } else { // Split 0x7fffffffffffffff into sum of two web numbers to avoid compilation @@ -46,7 +47,7 @@ main() { Expect.equals(-4503599627370499, (-4503599627370499.0).ceil()); Expect.equals(-9007199254740991, (-9007199254740991.0).ceil()); Expect.equals(-9007199254740992, (-9007199254740992.0).ceil()); - if (webNumbers) { + if (v.jsNumbers) { Expect.equals(-1.7976931348623157e+308, (-double.maxFinite).ceil()); } else { Expect.equals(-9223372036854775808, (-double.maxFinite).ceil()); diff --git a/tests/corelib/double_floor_test.dart b/tests/corelib/double_floor_test.dart index 074ad7fa8d1..ba64fea43eb 100644 --- a/tests/corelib/double_floor_test.dart +++ b/tests/corelib/double_floor_test.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:expect/expect.dart'; +import 'package:expect/variations.dart' as v; main() { Expect.equals(0, 0.0.floor()); @@ -24,7 +25,7 @@ main() { Expect.equals(9007199254740991, 9007199254740991.0.floor()); Expect.equals(9007199254740992, 9007199254740992.0.floor()); - if (webNumbers) { + if (v.jsNumbers) { Expect.equals(1.7976931348623157e+308, double.maxFinite.floor()); } else { // Split 0x7fffffffffffffff into sum of two web numbers to avoid compilation @@ -46,7 +47,7 @@ main() { Expect.equals(-4503599627370499, (-4503599627370499.0).floor()); Expect.equals(-9007199254740991, (-9007199254740991.0).floor()); Expect.equals(-9007199254740992, (-9007199254740992.0).floor()); - if (webNumbers) { + if (v.jsNumbers) { Expect.equals(-1.7976931348623157e+308, (-double.maxFinite).floor()); } else { Expect.equals(-9223372036854775808, (-double.maxFinite).floor()); diff --git a/tests/corelib/double_round_test.dart b/tests/corelib/double_round_test.dart index 6f21c7b69bf..8b233cd336d 100644 --- a/tests/corelib/double_round_test.dart +++ b/tests/corelib/double_round_test.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:expect/expect.dart'; +import 'package:expect/variations.dart' as v; main() { Expect.equals(0, 0.0.round()); @@ -14,7 +15,7 @@ main() { Expect.equals(1, 0.9999999999999999.round()); Expect.equals(1, 1.0.round()); Expect.equals(1, 1.000000000000001.round()); - if (webNumbers) { + if (v.jsNumbers) { Expect.equals(1.7976931348623157e+308, double.maxFinite.round()); } else { // Split 0x7fffffffffffffff into sum of two web numbers to avoid compilation @@ -29,7 +30,7 @@ main() { Expect.equals(-1, (-0.9999999999999999).round()); Expect.equals(-1, (-1.0).round()); Expect.equals(-1, (-1.000000000000001).round()); - if (webNumbers) { + if (v.jsNumbers) { Expect.equals(-1.7976931348623157e+308, (-double.maxFinite).round()); } else { Expect.equals(-9223372036854775808, (-double.maxFinite).round()); diff --git a/tests/corelib/double_truncate_test.dart b/tests/corelib/double_truncate_test.dart index 230e5c1468a..9ff51f33cd5 100644 --- a/tests/corelib/double_truncate_test.dart +++ b/tests/corelib/double_truncate_test.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:expect/expect.dart'; +import 'package:expect/variations.dart' as v; main() { Expect.equals(0, 0.0.truncate()); @@ -24,7 +25,7 @@ main() { Expect.equals(9007199254740991, 9007199254740991.0.truncate()); Expect.equals(9007199254740992, 9007199254740992.0.truncate()); - if (webNumbers) { + if (v.jsNumbers) { Expect.equals(1.7976931348623157e+308, double.maxFinite.truncate()); } else { // Split 0x7fffffffffffffff into sum of two web numbers to avoid compilation @@ -46,7 +47,7 @@ main() { Expect.equals(-4503599627370499, (-4503599627370499.0).truncate()); Expect.equals(-9007199254740991, (-9007199254740991.0).truncate()); Expect.equals(-9007199254740992, (-9007199254740992.0).truncate()); - if (webNumbers) { + if (v.jsNumbers) { Expect.equals(-1.7976931348623157e+308, (-double.maxFinite).truncate()); } else { Expect.equals(-9223372036854775808, (-double.maxFinite).truncate()); diff --git a/tests/corelib/hash_set_test.dart b/tests/corelib/hash_set_test.dart index c3a38858570..31044033836 100644 --- a/tests/corelib/hash_set_test.dart +++ b/tests/corelib/hash_set_test.dart @@ -10,6 +10,7 @@ library hash_map2_test; import "package:expect/expect.dart"; +import 'package:expect/variations.dart' as v; import 'dart:collection'; import 'dart:math' as math; @@ -315,7 +316,7 @@ void testIdentitySet(Set create()) { testIdentitySet ]; set.addAll(constants); - if (webNumbers) { + if (v.jsNumbers) { // 0.0 and -0.0 are identical in JS. Expect.equals(constants.length - 1, set.length); Expect.isTrue( @@ -327,7 +328,7 @@ void testIdentitySet(Set create()) { } for (var c in constants) { // identical(double.nan, double.nan) == false in JS. - if (webNumbers && c is double && c.isNaN) continue; + if (v.jsNumbers && c is double && c.isNaN) continue; Expect.isTrue(set.contains(c), "constant: $c"); } set.clear(); diff --git a/tests/corelib/int_parse_radix_test.dart b/tests/corelib/int_parse_radix_test.dart index f49c3439997..315cc87235c 100644 --- a/tests/corelib/int_parse_radix_test.dart +++ b/tests/corelib/int_parse_radix_test.dart @@ -3,10 +3,11 @@ // BSD-style license that can be found in the LICENSE file. import "package:expect/expect.dart"; +import 'package:expect/variations.dart' as v; import "dart:math" show pow, log; void main() { - final String oneByteWhiteSpace = webNumbers + final String oneByteWhiteSpace = v.jsNumbers ? "\x09\x0a\x0b\x0c\x0d\x20\xa0" : "\x09\x0a\x0b\x0c\x0d\x20\x85\xa0"; final String whiteSpace = "$oneByteWhiteSpace\u1680" diff --git a/tests/corelib/integer_to_string_test.dart b/tests/corelib/integer_to_string_test.dart index 3709f96f393..df6fc8c9136 100644 --- a/tests/corelib/integer_to_string_test.dart +++ b/tests/corelib/integer_to_string_test.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import "package:expect/expect.dart"; +import 'package:expect/variations.dart' as v; main() { /// Test that converting [value] to a string gives [expect]. @@ -52,7 +53,7 @@ main() { test(0x1fffffffffffff, "9007199254740991"); test(0x20000000000000, "9007199254740992"); // Split literals into sum of two web numbers to avoid compilation errors. - if (webNumbers) { + if (v.jsNumbers) { // The String for large integral web numbers (doubles) could be any sequence // of digits that parse back to the same value. The algorithm chooses 'nice' // rounded numbers rather than the equivalent digits for some multiple of a @@ -88,7 +89,7 @@ main() { // Numbers 99..99, 100...00, and 100..01 up to 18 digits. for (int i = 1; i < 19; i++) { // Works in dart2js up to 10^15. - if (webNumbers && i > 15) break; + if (v.jsNumbers && i > 15) break; test(number - 1, "9" * i); test(number, "1" + "0" * i); test(number + 1, "1" + "0" * (i - 1) + "1"); diff --git a/tests/language/double/identical_test.dart b/tests/language/double/identical_test.dart index 3080b391aaf..aa6883269ba 100644 --- a/tests/language/double/identical_test.dart +++ b/tests/language/double/identical_test.dart @@ -3,13 +3,14 @@ // BSD-style license that can be found in the LICENSE file. import "package:expect/expect.dart"; +import 'package:expect/variations.dart' as v; main() { Expect.isTrue(identical(42.0, 42.0)); Expect.isTrue(identical(-0.0, -0.0)); Expect.isTrue(identical(0.0, 0.0)); Expect.isTrue(identical(1.234E9, 1.234E9)); - if (!webNumbers) { + if (!v.jsNumbers) { Expect.isFalse(identical(0.0, -0.0)); Expect.isTrue(identical(double.nan, double.nan)); } else { diff --git a/tests/language/double/int_to_string_test.dart b/tests/language/double/int_to_string_test.dart index ebcc4903462..bed10273130 100644 --- a/tests/language/double/int_to_string_test.dart +++ b/tests/language/double/int_to_string_test.dart @@ -4,9 +4,10 @@ // Test basic integer operations. import "package:expect/expect.dart"; +import 'package:expect/variations.dart' as v; main() { - if (!webNumbers) { + if (!v.jsNumbers) { Expect.equals("0.0", (0.0).toString()); Expect.equals("9.0", (9.0).toString()); Expect.equals("90.0", (90.0).toString()); diff --git a/tests/language/identity/closure2_test.dart b/tests/language/identity/closure2_test.dart index ccc92c3b1d4..2fe32676d42 100644 --- a/tests/language/identity/closure2_test.dart +++ b/tests/language/identity/closure2_test.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import "package:expect/expect.dart"; +import 'package:expect/variations.dart' as v; var myIdentical = identical; @@ -10,7 +11,7 @@ main() { // Mint (2^63). Expect.isTrue(myIdentical(0x8000000000000000, 0x8000000000000000)); - if (!webNumbers) { + if (!v.jsNumbers) { Expect.isFalse(myIdentical(0x8000000000000000, 0x8000000000000000 + 1)); // Different types. diff --git a/tests/language/identity/nan_identical_test.dart b/tests/language/identity/nan_identical_test.dart index 501cbc386a8..c04e1334532 100644 --- a/tests/language/identity/nan_identical_test.dart +++ b/tests/language/identity/nan_identical_test.dart @@ -7,6 +7,7 @@ import 'dart:typed_data'; import "package:expect/expect.dart"; +import 'package:expect/variations.dart' as v; double uint64toDouble(int i) { var buffer = new Uint8List(8).buffer; @@ -20,7 +21,7 @@ double createOtherNAN() { } main() { - if (webNumbers) { + if (v.jsNumbers) { // (1) The web compilers elect to generate smaller, faster code for // `identical` using `===`, with the result that `identical(NaN, NaN)` is // false. diff --git a/tests/language/number/numbers_test.dart b/tests/language/number/numbers_test.dart index 5a4e8d17beb..0cd9183297d 100644 --- a/tests/language/number/numbers_test.dart +++ b/tests/language/number/numbers_test.dart @@ -6,6 +6,7 @@ library NumbersTest.dart; import "package:expect/expect.dart"; +import 'package:expect/variations.dart' as v; class NumbersTest { static double testMain() { @@ -13,18 +14,18 @@ class NumbersTest { Expect.equals(true, one is Object); Expect.equals(true, one is num); Expect.equals(true, one is int); - Expect.equals(webNumbers, one is double); + Expect.equals(v.jsNumbers, one is double); var two = 2.0; Expect.equals(true, two is Object); Expect.equals(true, two is num); - Expect.equals(webNumbers, two is int); + Expect.equals(v.jsNumbers, two is int); Expect.equals(true, two is double); var result = one + two; Expect.equals(true, result is Object); Expect.equals(true, result is num); - Expect.equals(webNumbers, result is int); + Expect.equals(v.jsNumbers, result is int); Expect.equals(true, result is double); Expect.equals(3.0, result); diff --git a/tests/language/operator/left_shift_test.dart b/tests/language/operator/left_shift_test.dart index 4cd12ba12bd..2be1c8658c7 100644 --- a/tests/language/operator/left_shift_test.dart +++ b/tests/language/operator/left_shift_test.dart @@ -3,12 +3,13 @@ // BSD-style license that can be found in the LICENSE file. import "package:expect/expect.dart"; +import 'package:expect/variations.dart' as v; main() { for (int i = 0; i < 80; i++) { var a = -1 << i; // web shifts produce a 32-bit unsigned result. Make it signed. - if (webNumbers) a = a.toSigned(32); + if (v.jsNumbers) a = a.toSigned(32); var b = -1; Expect.equals(1 << i, a ~/ b); } diff --git a/tests/language/operator/modulo_test.dart b/tests/language/operator/modulo_test.dart index a422d6a89b8..0dbde0e1d67 100644 --- a/tests/language/operator/modulo_test.dart +++ b/tests/language/operator/modulo_test.dart @@ -5,6 +5,7 @@ // VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-compilation import "package:expect/expect.dart"; +import 'package:expect/variations.dart' as v; main() { // Prime IC cache. @@ -14,7 +15,7 @@ main() { Expect.equals(i % 256, foo(i)); Expect.equals(i % -256, boo(i)); - if (!webNumbers) { + if (!v.jsNumbers) { Expect.throws(() => hoo(i), (e) => e is UnsupportedError); } else { // web numbers can't distinguish doubles from ints, so `i % 0`, which @@ -42,7 +43,7 @@ main() { Expect.equals(i ~/ i + i % i, fooTwo2(i)); } } - if (!webNumbers) { + if (!v.jsNumbers) { Expect.throws(() => foo2(0), (e) => e is UnsupportedError); } else { // web numbers can't distinguish doubles from ints, so `0 % 0`, which should diff --git a/tests/language/operator/truncdiv_zero_test.dart b/tests/language/operator/truncdiv_zero_test.dart index 989626b3579..db50eb271e4 100644 --- a/tests/language/operator/truncdiv_zero_test.dart +++ b/tests/language/operator/truncdiv_zero_test.dart @@ -5,11 +5,12 @@ // VMOptions=--optimization-counter-threshold=10 --no-use-osr import "package:expect/expect.dart"; +import 'package:expect/variations.dart' as v; import "truncdiv_test.dart" as truncdiv_test show foo, foo2; main() { - if (!webNumbers) { + if (!v.jsNumbers) { Expect.throws(() => truncdiv_test.foo(12, 0)); } else { // Web numbers consider infinities to be large-magnitide 'int' values.