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 // Test basic integer operations. | |
5 | |
6 main() { | |
7 Expect.equals("1e+0", (1.0).toStringAsExponential(null)); | |
8 Expect.equals("1.1e+1", (11.0).toStringAsExponential(null)); | |
9 Expect.equals("1.12e+2", (112.0).toStringAsExponential(null)); | |
10 Expect.equals("1e+0", (1.0).toStringAsExponential(0)); | |
11 Expect.equals("1e+1", (11.0).toStringAsExponential(0)); | |
12 Expect.equals("1e+2", (112.0).toStringAsExponential(0)); | |
13 Expect.equals("1.0e+0", (1.0).toStringAsExponential(1)); | |
14 Expect.equals("1.1e+1", (11.0).toStringAsExponential(1)); | |
15 Expect.equals("1.1e+2", (112.0).toStringAsExponential(1)); | |
16 Expect.equals("1.00e+0", (1.0).toStringAsExponential(2)); | |
17 Expect.equals("1.10e+1", (11.0).toStringAsExponential(2)); | |
18 Expect.equals("1.12e+2", (112.0).toStringAsExponential(2)); | |
19 Expect.equals("1.000e+0", (1.0).toStringAsExponential(3)); | |
20 Expect.equals("1.100e+1", (11.0).toStringAsExponential(3)); | |
21 Expect.equals("1.120e+2", (112.0).toStringAsExponential(3)); | |
22 Expect.equals("1e-1", (0.1).toStringAsExponential(null)); | |
23 Expect.equals("1.1e-1", (0.11).toStringAsExponential(null)); | |
24 Expect.equals("1.12e-1", (0.112).toStringAsExponential(null)); | |
25 Expect.equals("1e-1", (0.1).toStringAsExponential(0)); | |
26 Expect.equals("1e-1", (0.11).toStringAsExponential(0)); | |
27 Expect.equals("1e-1", (0.112).toStringAsExponential(0)); | |
28 Expect.equals("1.0e-1", (0.1).toStringAsExponential(1)); | |
29 Expect.equals("1.1e-1", (0.11).toStringAsExponential(1)); | |
30 Expect.equals("1.1e-1", (0.112).toStringAsExponential(1)); | |
31 Expect.equals("1.00e-1", (0.1).toStringAsExponential(2)); | |
32 Expect.equals("1.10e-1", (0.11).toStringAsExponential(2)); | |
33 Expect.equals("1.12e-1", (0.112).toStringAsExponential(2)); | |
34 Expect.equals("1.000e-1", (0.1).toStringAsExponential(3)); | |
35 Expect.equals("1.100e-1", (0.11).toStringAsExponential(3)); | |
36 Expect.equals("1.120e-1", (0.112).toStringAsExponential(3)); | |
37 | |
38 Expect.equals("-0e+0", (-0.0).toStringAsExponential(null)); | |
39 Expect.equals("-1e+0", (-1.0).toStringAsExponential(null)); | |
40 Expect.equals("-1.1e+1", (-11.0).toStringAsExponential(null)); | |
41 Expect.equals("-1.12e+2", (-112.0).toStringAsExponential(null)); | |
42 Expect.equals("-1e+0", (-1.0).toStringAsExponential(0)); | |
43 Expect.equals("-1e+1", (-11.0).toStringAsExponential(0)); | |
44 Expect.equals("-1e+2", (-112.0).toStringAsExponential(0)); | |
45 Expect.equals("-1.0e+0", (-1.0).toStringAsExponential(1)); | |
46 Expect.equals("-1.1e+1", (-11.0).toStringAsExponential(1)); | |
47 Expect.equals("-1.1e+2", (-112.0).toStringAsExponential(1)); | |
48 Expect.equals("-1.00e+0", (-1.0).toStringAsExponential(2)); | |
49 Expect.equals("-1.10e+1", (-11.0).toStringAsExponential(2)); | |
50 Expect.equals("-1.12e+2", (-112.0).toStringAsExponential(2)); | |
51 Expect.equals("-1.000e+0", (-1.0).toStringAsExponential(3)); | |
52 Expect.equals("-1.100e+1", (-11.0).toStringAsExponential(3)); | |
53 Expect.equals("-1.120e+2", (-112.0).toStringAsExponential(3)); | |
54 Expect.equals("-1e-1", (-0.1).toStringAsExponential(null)); | |
55 Expect.equals("-1.1e-1", (-0.11).toStringAsExponential(null)); | |
56 Expect.equals("-1.12e-1", (-0.112).toStringAsExponential(null)); | |
57 Expect.equals("-1e-1", (-0.1).toStringAsExponential(0)); | |
58 Expect.equals("-1e-1", (-0.11).toStringAsExponential(0)); | |
59 Expect.equals("-1e-1", (-0.112).toStringAsExponential(0)); | |
60 Expect.equals("-1.0e-1", (-0.1).toStringAsExponential(1)); | |
61 Expect.equals("-1.1e-1", (-0.11).toStringAsExponential(1)); | |
62 Expect.equals("-1.1e-1", (-0.112).toStringAsExponential(1)); | |
63 Expect.equals("-1.00e-1", (-0.1).toStringAsExponential(2)); | |
64 Expect.equals("-1.10e-1", (-0.11).toStringAsExponential(2)); | |
65 Expect.equals("-1.12e-1", (-0.112).toStringAsExponential(2)); | |
66 Expect.equals("-1.000e-1", (-0.1).toStringAsExponential(3)); | |
67 Expect.equals("-1.100e-1", (-0.11).toStringAsExponential(3)); | |
68 Expect.equals("-1.120e-1", (-0.112).toStringAsExponential(3)); | |
69 | |
70 Expect.equals("NaN", (double.NAN).toStringAsExponential(2)); | |
71 Expect.equals("Infinity", (double.INFINITY).toStringAsExponential(2)); | |
72 Expect.equals("-Infinity", (-double.INFINITY).toStringAsExponential(2)); | |
73 Expect.equals("1e+0", (1.0).toStringAsExponential(0)); | |
74 Expect.equals("0e+0", (0.0).toStringAsExponential(null)); | |
75 Expect.equals("0.00e+0", (0.0).toStringAsExponential(2)); | |
76 Expect.equals("1e+1", (11.2356).toStringAsExponential(0)); | |
77 Expect.equals("1.1236e+1", (11.2356).toStringAsExponential(4)); | |
78 Expect.equals("1.1236e-4", (0.000112356).toStringAsExponential(4)); | |
79 Expect.equals("-1.1236e-4", (-0.000112356).toStringAsExponential(4)); | |
80 Expect.equals("1.12356e-4", (0.000112356).toStringAsExponential(null)); | |
81 Expect.equals("-1.12356e-4", (-0.000112356).toStringAsExponential(null)); | |
82 } | |
OLD | NEW |