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

Side by Side Diff: tests/language/double_to_string_as_exponential_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 // Test basic integer operations. 4 // Test basic integer operations.
5 5
6 main() { 6 main() {
7 Expect.equals("1e+0", (1.0).toStringAsExponential());
8 Expect.equals("1.1e+1", (11.0).toStringAsExponential());
9 Expect.equals("1.12e+2", (112.0).toStringAsExponential());
7 Expect.equals("1e+0", (1.0).toStringAsExponential(null)); 10 Expect.equals("1e+0", (1.0).toStringAsExponential(null));
8 Expect.equals("1.1e+1", (11.0).toStringAsExponential(null)); 11 Expect.equals("1.1e+1", (11.0).toStringAsExponential(null));
9 Expect.equals("1.12e+2", (112.0).toStringAsExponential(null)); 12 Expect.equals("1.12e+2", (112.0).toStringAsExponential(null));
10 Expect.equals("1e+0", (1.0).toStringAsExponential(0)); 13 Expect.equals("1e+0", (1.0).toStringAsExponential(0));
11 Expect.equals("1e+1", (11.0).toStringAsExponential(0)); 14 Expect.equals("1e+1", (11.0).toStringAsExponential(0));
12 Expect.equals("1e+2", (112.0).toStringAsExponential(0)); 15 Expect.equals("1e+2", (112.0).toStringAsExponential(0));
13 Expect.equals("1.0e+0", (1.0).toStringAsExponential(1)); 16 Expect.equals("1.0e+0", (1.0).toStringAsExponential(1));
14 Expect.equals("1.1e+1", (11.0).toStringAsExponential(1)); 17 Expect.equals("1.1e+1", (11.0).toStringAsExponential(1));
15 Expect.equals("1.1e+2", (112.0).toStringAsExponential(1)); 18 Expect.equals("1.1e+2", (112.0).toStringAsExponential(1));
16 Expect.equals("1.00e+0", (1.0).toStringAsExponential(2)); 19 Expect.equals("1.00e+0", (1.0).toStringAsExponential(2));
17 Expect.equals("1.10e+1", (11.0).toStringAsExponential(2)); 20 Expect.equals("1.10e+1", (11.0).toStringAsExponential(2));
18 Expect.equals("1.12e+2", (112.0).toStringAsExponential(2)); 21 Expect.equals("1.12e+2", (112.0).toStringAsExponential(2));
19 Expect.equals("1.000e+0", (1.0).toStringAsExponential(3)); 22 Expect.equals("1.000e+0", (1.0).toStringAsExponential(3));
20 Expect.equals("1.100e+1", (11.0).toStringAsExponential(3)); 23 Expect.equals("1.100e+1", (11.0).toStringAsExponential(3));
21 Expect.equals("1.120e+2", (112.0).toStringAsExponential(3)); 24 Expect.equals("1.120e+2", (112.0).toStringAsExponential(3));
25 Expect.equals("1e-1", (0.1).toStringAsExponential());
26 Expect.equals("1.1e-1", (0.11).toStringAsExponential());
27 Expect.equals("1.12e-1", (0.112).toStringAsExponential());
22 Expect.equals("1e-1", (0.1).toStringAsExponential(null)); 28 Expect.equals("1e-1", (0.1).toStringAsExponential(null));
23 Expect.equals("1.1e-1", (0.11).toStringAsExponential(null)); 29 Expect.equals("1.1e-1", (0.11).toStringAsExponential(null));
24 Expect.equals("1.12e-1", (0.112).toStringAsExponential(null)); 30 Expect.equals("1.12e-1", (0.112).toStringAsExponential(null));
25 Expect.equals("1e-1", (0.1).toStringAsExponential(0)); 31 Expect.equals("1e-1", (0.1).toStringAsExponential(0));
26 Expect.equals("1e-1", (0.11).toStringAsExponential(0)); 32 Expect.equals("1e-1", (0.11).toStringAsExponential(0));
27 Expect.equals("1e-1", (0.112).toStringAsExponential(0)); 33 Expect.equals("1e-1", (0.112).toStringAsExponential(0));
28 Expect.equals("1.0e-1", (0.1).toStringAsExponential(1)); 34 Expect.equals("1.0e-1", (0.1).toStringAsExponential(1));
29 Expect.equals("1.1e-1", (0.11).toStringAsExponential(1)); 35 Expect.equals("1.1e-1", (0.11).toStringAsExponential(1));
30 Expect.equals("1.1e-1", (0.112).toStringAsExponential(1)); 36 Expect.equals("1.1e-1", (0.112).toStringAsExponential(1));
31 Expect.equals("1.00e-1", (0.1).toStringAsExponential(2)); 37 Expect.equals("1.00e-1", (0.1).toStringAsExponential(2));
32 Expect.equals("1.10e-1", (0.11).toStringAsExponential(2)); 38 Expect.equals("1.10e-1", (0.11).toStringAsExponential(2));
33 Expect.equals("1.12e-1", (0.112).toStringAsExponential(2)); 39 Expect.equals("1.12e-1", (0.112).toStringAsExponential(2));
34 Expect.equals("1.000e-1", (0.1).toStringAsExponential(3)); 40 Expect.equals("1.000e-1", (0.1).toStringAsExponential(3));
35 Expect.equals("1.100e-1", (0.11).toStringAsExponential(3)); 41 Expect.equals("1.100e-1", (0.11).toStringAsExponential(3));
36 Expect.equals("1.120e-1", (0.112).toStringAsExponential(3)); 42 Expect.equals("1.120e-1", (0.112).toStringAsExponential(3));
37 43
44 Expect.equals("-0e+0", (-0.0).toStringAsExponential());
45 Expect.equals("-1e+0", (-1.0).toStringAsExponential());
46 Expect.equals("-1.1e+1", (-11.0).toStringAsExponential());
47 Expect.equals("-1.12e+2", (-112.0).toStringAsExponential());
38 Expect.equals("-0e+0", (-0.0).toStringAsExponential(null)); 48 Expect.equals("-0e+0", (-0.0).toStringAsExponential(null));
39 Expect.equals("-1e+0", (-1.0).toStringAsExponential(null)); 49 Expect.equals("-1e+0", (-1.0).toStringAsExponential(null));
40 Expect.equals("-1.1e+1", (-11.0).toStringAsExponential(null)); 50 Expect.equals("-1.1e+1", (-11.0).toStringAsExponential(null));
41 Expect.equals("-1.12e+2", (-112.0).toStringAsExponential(null)); 51 Expect.equals("-1.12e+2", (-112.0).toStringAsExponential(null));
42 Expect.equals("-1e+0", (-1.0).toStringAsExponential(0)); 52 Expect.equals("-1e+0", (-1.0).toStringAsExponential(0));
43 Expect.equals("-1e+1", (-11.0).toStringAsExponential(0)); 53 Expect.equals("-1e+1", (-11.0).toStringAsExponential(0));
44 Expect.equals("-1e+2", (-112.0).toStringAsExponential(0)); 54 Expect.equals("-1e+2", (-112.0).toStringAsExponential(0));
45 Expect.equals("-1.0e+0", (-1.0).toStringAsExponential(1)); 55 Expect.equals("-1.0e+0", (-1.0).toStringAsExponential(1));
46 Expect.equals("-1.1e+1", (-11.0).toStringAsExponential(1)); 56 Expect.equals("-1.1e+1", (-11.0).toStringAsExponential(1));
47 Expect.equals("-1.1e+2", (-112.0).toStringAsExponential(1)); 57 Expect.equals("-1.1e+2", (-112.0).toStringAsExponential(1));
48 Expect.equals("-1.00e+0", (-1.0).toStringAsExponential(2)); 58 Expect.equals("-1.00e+0", (-1.0).toStringAsExponential(2));
49 Expect.equals("-1.10e+1", (-11.0).toStringAsExponential(2)); 59 Expect.equals("-1.10e+1", (-11.0).toStringAsExponential(2));
50 Expect.equals("-1.12e+2", (-112.0).toStringAsExponential(2)); 60 Expect.equals("-1.12e+2", (-112.0).toStringAsExponential(2));
51 Expect.equals("-1.000e+0", (-1.0).toStringAsExponential(3)); 61 Expect.equals("-1.000e+0", (-1.0).toStringAsExponential(3));
52 Expect.equals("-1.100e+1", (-11.0).toStringAsExponential(3)); 62 Expect.equals("-1.100e+1", (-11.0).toStringAsExponential(3));
53 Expect.equals("-1.120e+2", (-112.0).toStringAsExponential(3)); 63 Expect.equals("-1.120e+2", (-112.0).toStringAsExponential(3));
64 Expect.equals("-1e-1", (-0.1).toStringAsExponential());
65 Expect.equals("-1.1e-1", (-0.11).toStringAsExponential());
66 Expect.equals("-1.12e-1", (-0.112).toStringAsExponential());
54 Expect.equals("-1e-1", (-0.1).toStringAsExponential(null)); 67 Expect.equals("-1e-1", (-0.1).toStringAsExponential(null));
55 Expect.equals("-1.1e-1", (-0.11).toStringAsExponential(null)); 68 Expect.equals("-1.1e-1", (-0.11).toStringAsExponential(null));
56 Expect.equals("-1.12e-1", (-0.112).toStringAsExponential(null)); 69 Expect.equals("-1.12e-1", (-0.112).toStringAsExponential(null));
57 Expect.equals("-1e-1", (-0.1).toStringAsExponential(0)); 70 Expect.equals("-1e-1", (-0.1).toStringAsExponential(0));
58 Expect.equals("-1e-1", (-0.11).toStringAsExponential(0)); 71 Expect.equals("-1e-1", (-0.11).toStringAsExponential(0));
59 Expect.equals("-1e-1", (-0.112).toStringAsExponential(0)); 72 Expect.equals("-1e-1", (-0.112).toStringAsExponential(0));
60 Expect.equals("-1.0e-1", (-0.1).toStringAsExponential(1)); 73 Expect.equals("-1.0e-1", (-0.1).toStringAsExponential(1));
61 Expect.equals("-1.1e-1", (-0.11).toStringAsExponential(1)); 74 Expect.equals("-1.1e-1", (-0.11).toStringAsExponential(1));
62 Expect.equals("-1.1e-1", (-0.112).toStringAsExponential(1)); 75 Expect.equals("-1.1e-1", (-0.112).toStringAsExponential(1));
63 Expect.equals("-1.00e-1", (-0.1).toStringAsExponential(2)); 76 Expect.equals("-1.00e-1", (-0.1).toStringAsExponential(2));
64 Expect.equals("-1.10e-1", (-0.11).toStringAsExponential(2)); 77 Expect.equals("-1.10e-1", (-0.11).toStringAsExponential(2));
65 Expect.equals("-1.12e-1", (-0.112).toStringAsExponential(2)); 78 Expect.equals("-1.12e-1", (-0.112).toStringAsExponential(2));
66 Expect.equals("-1.000e-1", (-0.1).toStringAsExponential(3)); 79 Expect.equals("-1.000e-1", (-0.1).toStringAsExponential(3));
67 Expect.equals("-1.100e-1", (-0.11).toStringAsExponential(3)); 80 Expect.equals("-1.100e-1", (-0.11).toStringAsExponential(3));
68 Expect.equals("-1.120e-1", (-0.112).toStringAsExponential(3)); 81 Expect.equals("-1.120e-1", (-0.112).toStringAsExponential(3));
69 82
70 Expect.equals("NaN", (double.NAN).toStringAsExponential(2)); 83 Expect.equals("NaN", (double.NAN).toStringAsExponential(2));
71 Expect.equals("Infinity", (double.INFINITY).toStringAsExponential(2)); 84 Expect.equals("Infinity", (double.INFINITY).toStringAsExponential(2));
72 Expect.equals("-Infinity", (-double.INFINITY).toStringAsExponential(2)); 85 Expect.equals("-Infinity", (-double.INFINITY).toStringAsExponential(2));
73 Expect.equals("1e+0", (1.0).toStringAsExponential(0)); 86 Expect.equals("1e+0", (1.0).toStringAsExponential(0));
87 Expect.equals("0e+0", (0.0).toStringAsExponential());
74 Expect.equals("0e+0", (0.0).toStringAsExponential(null)); 88 Expect.equals("0e+0", (0.0).toStringAsExponential(null));
75 Expect.equals("0.00e+0", (0.0).toStringAsExponential(2)); 89 Expect.equals("0.00e+0", (0.0).toStringAsExponential(2));
76 Expect.equals("1e+1", (11.2356).toStringAsExponential(0)); 90 Expect.equals("1e+1", (11.2356).toStringAsExponential(0));
77 Expect.equals("1.1236e+1", (11.2356).toStringAsExponential(4)); 91 Expect.equals("1.1236e+1", (11.2356).toStringAsExponential(4));
78 Expect.equals("1.1236e-4", (0.000112356).toStringAsExponential(4)); 92 Expect.equals("1.1236e-4", (0.000112356).toStringAsExponential(4));
79 Expect.equals("-1.1236e-4", (-0.000112356).toStringAsExponential(4)); 93 Expect.equals("-1.1236e-4", (-0.000112356).toStringAsExponential(4));
94 Expect.equals("1.12356e-4", (0.000112356).toStringAsExponential());
95 Expect.equals("-1.12356e-4", (-0.000112356).toStringAsExponential());
80 Expect.equals("1.12356e-4", (0.000112356).toStringAsExponential(null)); 96 Expect.equals("1.12356e-4", (0.000112356).toStringAsExponential(null));
81 Expect.equals("-1.12356e-4", (-0.000112356).toStringAsExponential(null)); 97 Expect.equals("-1.12356e-4", (-0.000112356).toStringAsExponential(null));
82 } 98 }
OLDNEW
« no previous file with comments | « tests/language/double_to_string_as_exponential3_test.dart ('k') | tests/language/double_to_string_as_fixed2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698