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

Side by Side Diff: tests/corelib/integer_to_string_test.dart

Issue 2774783002: Re-land "Format all multitests" (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « tests/corelib/int_parse_radix_test.dart ('k') | tests/corelib/iterable_generate_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 main() { 7 main() {
8 /// Test that converting [value] to a string gives [expect]. 8 /// Test that converting [value] to a string gives [expect].
9 /// Also test that `-value` gives `"-"+expect`. 9 /// Also test that `-value` gives `"-"+expect`.
10 test(int value, String expect) { 10 test(int value, String expect) {
(...skipping 18 matching lines...) Expand all
29 29
30 // ~2^30. 30 // ~2^30.
31 test(0x3fffffff, "1073741823"); 31 test(0x3fffffff, "1073741823");
32 test(0x40000000, "1073741824"); 32 test(0x40000000, "1073741824");
33 test(0x40000001, "1073741825"); 33 test(0x40000001, "1073741825");
34 // ~2^31. 34 // ~2^31.
35 test(0x7fffffff, "2147483647"); 35 test(0x7fffffff, "2147483647");
36 test(0x80000000, "2147483648"); 36 test(0x80000000, "2147483648");
37 test(0x80000001, "2147483649"); 37 test(0x80000001, "2147483649");
38 // ~2^32. 38 // ~2^32.
39 test(0xffffffff, "4294967295"); 39 test(0xffffffff, "4294967295");
40 test(0x100000000, "4294967296"); 40 test(0x100000000, "4294967296");
41 test(0x100000001, "4294967297"); 41 test(0x100000001, "4294967297");
42 42
43 // ~2^51. 43 // ~2^51.
44 test(0x7ffffffffffff, "2251799813685247"); 44 test(0x7ffffffffffff, "2251799813685247");
45 test(0x8000000000000, "2251799813685248"); 45 test(0x8000000000000, "2251799813685248");
46 test(0x8000000000001, "2251799813685249"); 46 test(0x8000000000001, "2251799813685249");
47 // ~2^52. 47 // ~2^52.
48 test(0xfffffffffffff, "4503599627370495"); 48 test(0xfffffffffffff, "4503599627370495");
49 test(0x10000000000000, "4503599627370496"); 49 test(0x10000000000000, "4503599627370496");
(...skipping 15 matching lines...) Expand all
65 test(0x10000000000000000, "18446744073709551616"); // //# 01: continued 65 test(0x10000000000000000, "18446744073709551616"); // //# 01: continued
66 test(0x10000000000000001, "18446744073709551617"); // //# 01: continued 66 test(0x10000000000000001, "18446744073709551617"); // //# 01: continued
67 // Big bignum. 67 // Big bignum.
68 test(123456789012345678901234567890, // //# 01: continued 68 test(123456789012345678901234567890, // //# 01: continued
69 "123456789012345678901234567890"); // //# 01: continued 69 "123456789012345678901234567890"); // //# 01: continued
70 70
71 // Decimal special cases. 71 // Decimal special cases.
72 72
73 int number = 10; 73 int number = 10;
74 // Numbers 99..99, 100...00, and 100..01 up to 23 digits. 74 // Numbers 99..99, 100...00, and 100..01 up to 23 digits.
75 for (int i = 1; i < 15; i++) { // Works in dart2js up to 10^15. 75 for (int i = 1; i < 15; i++) {
76 // Works in dart2js up to 10^15.
76 test(number - 1, "9" * i); 77 test(number - 1, "9" * i);
77 test(number, "1" + "0" * i); 78 test(number, "1" + "0" * i);
78 test(number + 1, "1" + "0" * (i - 1) + "1"); 79 test(number + 1, "1" + "0" * (i - 1) + "1");
79 number *= 10; 80 number *= 10;
80 } 81 }
81 // Fails to represent exactly in dart2js. 82 // Fails to represent exactly in dart2js.
82 for (int i = 15; i < 22; i++) { // //# 01: continued 83 for (int i = 15; i < 22; i++) { // //# 01: continued
83 test(number - 1, "9" * i); // //# 01: continued 84 test(number - 1, "9" * i); // //# 01: continued
84 test(number, "1" + "0" * i); // //# 01: continued 85 test(number, "1" + "0" * i); // //# 01: continued
85 test(number + 1, "1" + "0" * (i - 1) + "1"); // //# 01: continued 86 test(number + 1, "1" + "0" * (i - 1) + "1"); // //# 01: continued
86 number *= 10; // //# 01: continued 87 number *= 10; // //# 01: continued
87 } // //# 01: continued 88 } // //# 01: continued
88 } 89 }
OLDNEW
« no previous file with comments | « tests/corelib/int_parse_radix_test.dart ('k') | tests/corelib/iterable_generate_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698