OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/double_to_string_as_precision_test', null, /* Imp
orts */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__double_to_string_as_precision_test(exports, dart_sdk, expect)
{ |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const dart = dart_sdk.dart; |
| 8 const dartx = dart_sdk.dartx; |
| 9 const expect$ = expect.expect; |
| 10 const double_to_string_as_precision_test = Object.create(null); |
| 11 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 12 double_to_string_as_precision_test.main = function() { |
| 13 expect$.Expect.equals("NaN", core.double.NAN[dartx.toStringAsPrecision](1)); |
| 14 expect$.Expect.equals("Infinity", core.double.INFINITY[dartx.toStringAsPreci
sion](2)); |
| 15 expect$.Expect.equals("-Infinity", (-dart.notNull(core.double.INFINITY))[dar
tx.toStringAsPrecision](2)); |
| 16 expect$.Expect.equals("0.000555000000000000", 0.000555[dartx.toStringAsPreci
sion](15)); |
| 17 expect$.Expect.equals("5.55000000000000e-7", 5.55e-7[dartx.toStringAsPrecisi
on](15)); |
| 18 expect$.Expect.equals("-5.55000000000000e-7", (-5.55e-7)[dartx.toStringAsPre
cision](15)); |
| 19 expect$.Expect.equals("1e+8", 123456789.0[dartx.toStringAsPrecision](1)); |
| 20 expect$.Expect.equals("123456789", 123456789.0[dartx.toStringAsPrecision](9)
); |
| 21 expect$.Expect.equals("1.2345679e+8", 123456789.0[dartx.toStringAsPrecision]
(8)); |
| 22 expect$.Expect.equals("1.234568e+8", 123456789.0[dartx.toStringAsPrecision](
7)); |
| 23 expect$.Expect.equals("-1.234568e+8", (-123456789.0)[dartx.toStringAsPrecisi
on](7)); |
| 24 expect$.Expect.equals("-1.2e-9", (-1.2345e-9)[dartx.toStringAsPrecision](2))
; |
| 25 expect$.Expect.equals("-1.2e-8", (-1.2345e-8)[dartx.toStringAsPrecision](2))
; |
| 26 expect$.Expect.equals("-1.2e-7", (-1.2345e-7)[dartx.toStringAsPrecision](2))
; |
| 27 expect$.Expect.equals("-0.0000012", (-0.0000012345)[dartx.toStringAsPrecisio
n](2)); |
| 28 expect$.Expect.equals("-0.000012", (-0.000012345)[dartx.toStringAsPrecision]
(2)); |
| 29 expect$.Expect.equals("-0.00012", (-0.00012345)[dartx.toStringAsPrecision](2
)); |
| 30 expect$.Expect.equals("-0.0012", (-0.0012345)[dartx.toStringAsPrecision](2))
; |
| 31 expect$.Expect.equals("-0.012", (-0.012345)[dartx.toStringAsPrecision](2)); |
| 32 expect$.Expect.equals("-0.12", (-0.12345)[dartx.toStringAsPrecision](2)); |
| 33 expect$.Expect.equals("-1.2", (-1.2345)[dartx.toStringAsPrecision](2)); |
| 34 expect$.Expect.equals("-12", (-12.345)[dartx.toStringAsPrecision](2)); |
| 35 expect$.Expect.equals("-1.2e+2", (-123.45)[dartx.toStringAsPrecision](2)); |
| 36 expect$.Expect.equals("-1.2e+3", (-1234.5)[dartx.toStringAsPrecision](2)); |
| 37 expect$.Expect.equals("-1.2e+4", (-12345.0)[dartx.toStringAsPrecision](2)); |
| 38 expect$.Expect.equals("-1.235e+4", (-12345.67)[dartx.toStringAsPrecision](4)
); |
| 39 expect$.Expect.equals("-1.234e+4", (-12344.67)[dartx.toStringAsPrecision](4)
); |
| 40 expect$.Expect.equals("-0.0", (-0.0)[dartx.toStringAsPrecision](2)); |
| 41 expect$.Expect.equals("-0", (-0.0)[dartx.toStringAsPrecision](1)); |
| 42 expect$.Expect.equals("1.3", 1.25[dartx.toStringAsPrecision](2)); |
| 43 expect$.Expect.equals("1.4", 1.35[dartx.toStringAsPrecision](2)); |
| 44 }; |
| 45 dart.fn(double_to_string_as_precision_test.main, VoidTodynamic()); |
| 46 // Exports: |
| 47 exports.double_to_string_as_precision_test = double_to_string_as_precision_tes
t; |
| 48 }); |
OLD | NEW |