Index: test/codegen/expect/corelib/double_truncate_test.js |
diff --git a/test/codegen/expect/corelib/double_truncate_test.js b/test/codegen/expect/corelib/double_truncate_test.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..67a6dac2ba0589c066517a30247307c74769f475 |
--- /dev/null |
+++ b/test/codegen/expect/corelib/double_truncate_test.js |
@@ -0,0 +1,90 @@ |
+dart_library.library('corelib/double_truncate_test', null, /* Imports */[ |
+ 'dart_sdk', |
+ 'expect' |
+], function load__double_truncate_test(exports, dart_sdk, expect) { |
+ 'use strict'; |
+ const core = dart_sdk.core; |
+ const dart = dart_sdk.dart; |
+ const dartx = dart_sdk.dartx; |
+ const expect$ = expect.expect; |
+ const double_truncate_test = Object.create(null); |
+ let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))(); |
+ double_truncate_test.main = function() { |
+ expect$.Expect.equals(0, 0.0[dartx.truncate]()); |
+ expect$.Expect.equals(0, core.double.MIN_POSITIVE[dartx.truncate]()); |
+ expect$.Expect.equals(0, (2.0 * dart.notNull(core.double.MIN_POSITIVE))[dartx.truncate]()); |
+ expect$.Expect.equals(0, 1.18e-38[dartx.truncate]()); |
+ expect$.Expect.equals(0, (1.18e-38 * 2)[dartx.truncate]()); |
+ expect$.Expect.equals(0, 0.49999999999999994[dartx.truncate]()); |
+ expect$.Expect.equals(0, 0.5[dartx.truncate]()); |
+ expect$.Expect.equals(0, 0.9999999999999999[dartx.truncate]()); |
+ expect$.Expect.equals(1, 1.0[dartx.truncate]()); |
+ expect$.Expect.equals(1, 1.000000000000001[dartx.truncate]()); |
+ expect$.Expect.equals(4503599627370496, 4503599627370496.0[dartx.truncate]()); |
+ expect$.Expect.equals(4503599627370497, 4503599627370497.0[dartx.truncate]()); |
+ expect$.Expect.equals(4503599627370498, 4503599627370498.0[dartx.truncate]()); |
+ expect$.Expect.equals(4503599627370499, 4503599627370499.0[dartx.truncate]()); |
+ expect$.Expect.equals(9007199254740991, 9007199254740991.0[dartx.truncate]()); |
+ expect$.Expect.equals(9007199254740992, 9007199254740992.0[dartx.truncate]()); |
+ expect$.Expect.equals(179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368, core.double.MAX_FINITE[dartx.truncate]()); |
+ expect$.Expect.equals(0, (-dart.notNull(core.double.MIN_POSITIVE))[dartx.truncate]()); |
+ expect$.Expect.equals(0, (2.0 * -dart.notNull(core.double.MIN_POSITIVE))[dartx.truncate]()); |
+ expect$.Expect.equals(0, (-1.18e-38)[dartx.truncate]()); |
+ expect$.Expect.equals(0, (-1.18e-38 * 2)[dartx.truncate]()); |
+ expect$.Expect.equals(0, (-0.49999999999999994)[dartx.truncate]()); |
+ expect$.Expect.equals(0, (-0.5)[dartx.truncate]()); |
+ expect$.Expect.equals(0, (-0.9999999999999999)[dartx.truncate]()); |
+ expect$.Expect.equals(-1, (-1.0)[dartx.truncate]()); |
+ expect$.Expect.equals(-1, (-1.000000000000001)[dartx.truncate]()); |
+ expect$.Expect.equals(-4503599627370496, (-4503599627370496.0)[dartx.truncate]()); |
+ expect$.Expect.equals(-4503599627370497, (-4503599627370497.0)[dartx.truncate]()); |
+ expect$.Expect.equals(-4503599627370498, (-4503599627370498.0)[dartx.truncate]()); |
+ expect$.Expect.equals(-4503599627370499, (-4503599627370499.0)[dartx.truncate]()); |
+ expect$.Expect.equals(-9007199254740991, (-9007199254740991.0)[dartx.truncate]()); |
+ expect$.Expect.equals(-9007199254740992, (-9007199254740992.0)[dartx.truncate]()); |
+ expect$.Expect.equals(-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368, (-dart.notNull(core.double.MAX_FINITE))[dartx.truncate]()); |
+ expect$.Expect.isTrue(typeof 0.0[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof core.double.MIN_POSITIVE[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (2.0 * dart.notNull(core.double.MIN_POSITIVE))[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof 1.18e-38[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (1.18e-38 * 2)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof 0.49999999999999994[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof 0.5[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof 0.9999999999999999[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof 1.0[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof 1.000000000000001[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof 4503599627370496.0[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof 4503599627370497.0[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof 4503599627370498.0[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof 4503599627370499.0[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof 9007199254740991.0[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof 9007199254740992.0[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof core.double.MAX_FINITE[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue((-dart.notNull(core.double.MIN_POSITIVE))[dartx.truncateToDouble]()[dartx.isNegative]); |
+ expect$.Expect.isTrue((2.0 * -dart.notNull(core.double.MIN_POSITIVE))[dartx.truncateToDouble]()[dartx.isNegative]); |
+ expect$.Expect.isTrue((-1.18e-38)[dartx.truncateToDouble]()[dartx.isNegative]); |
+ expect$.Expect.isTrue((-1.18e-38 * 2)[dartx.truncateToDouble]()[dartx.isNegative]); |
+ expect$.Expect.isTrue((-0.49999999999999994)[dartx.truncateToDouble]()[dartx.isNegative]); |
+ expect$.Expect.isTrue((-0.5)[dartx.truncateToDouble]()[dartx.isNegative]); |
+ expect$.Expect.isTrue((-0.9999999999999999)[dartx.truncateToDouble]()[dartx.isNegative]); |
+ expect$.Expect.isTrue(typeof (-dart.notNull(core.double.MIN_POSITIVE))[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (2.0 * -dart.notNull(core.double.MIN_POSITIVE))[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-1.18e-38)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-1.18e-38 * 2)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-0.49999999999999994)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-0.5)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-0.9999999999999999)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-1.0)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-1.000000000000001)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-4503599627370496.0)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-4503599627370497.0)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-4503599627370498.0)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-4503599627370499.0)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-9007199254740991.0)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-9007199254740992.0)[dartx.truncate]() == 'number'); |
+ expect$.Expect.isTrue(typeof (-dart.notNull(core.double.MAX_FINITE))[dartx.truncate]() == 'number'); |
+ }; |
+ dart.fn(double_truncate_test.main, VoidTodynamic()); |
+ // Exports: |
+ exports.double_truncate_test = double_truncate_test; |
+}); |