Skip to content

Commit 8673b5e

Browse files
rakudramacommit-bot@chromium.org
authored andcommitted
Avoid non-web-integer literals in corelib_2/num_sign_test
Change-Id: I756ef8129b0e1c7024833fb98ed96eea987dbb59 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108280 Reviewed-by: Lasse R.H. Nielsen <[email protected]> Commit-Queue: Stephen Adams <[email protected]>
1 parent f0da490 commit 8673b5e

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

tests/corelib_2/corelib_2.status

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ iterable_return_type_test/02: RuntimeError # Dart2js does not support Uint64*.
4141
list_unmodifiable_test: Pass, RuntimeError # Issue 28712
4242
num_parse_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
4343
num_parse_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
44-
num_sign_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
4544

4645
[ $compiler != dartdevc ]
4746
error_stack_trace_test/static: MissingCompileTimeError
@@ -319,7 +318,6 @@ main_test: RuntimeError # Issue 29921
319318
nan_infinity_test/01: RuntimeError # Issue 29921
320319
num_parse_test/01: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
321320
num_parse_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
322-
num_sign_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
323321
regexp/alternative-length-miscalculation_test: RuntimeError # Issue 29921
324322
regexp/ascii-regexp-subject_test: RuntimeError # Issue 29921
325323
regexp/bol-with-multiline_test: RuntimeError # Issue 29921

tests/corelib_2/num_sign_test.dart

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,51 +25,54 @@ var numbers = [
2525
0,
2626
1,
2727
2,
28-
0x7f, // ~7 bits
28+
0x7f, // ~7 bits
2929
0x80,
30-
0xff, // ~8 bits
30+
0xff, // ~8 bits
3131
0x100,
32-
0xffff, // ~16 bits
32+
0xffff, // ~16 bits
3333
0x10000,
34-
0x3fffffff, // ~30 bits (max positive 32-bit tagged smi)
34+
0x3fffffff, // ~30 bits (max positive 32-bit tagged smi)
3535
0x40000000,
3636
0x40000001,
37-
0x7fffffff, // ~31 bits
37+
0x7fffffff, // ~31 bits
3838
0x80000000,
3939
0x80000001,
40-
0xfffffffff, // ~32 bits
40+
0xfffffffff, // ~32 bits
4141
0x100000000,
4242
0x100000001,
43-
0x10000000000000, // ~53 bits
43+
0x10000000000000, // ~53 bits
4444
0x10000000000001,
4545
0x1fffffffffffff,
4646
0x20000000000000,
47-
0x20000000000001, // first integer not representable as double.
48-
0x20000000000002,
49-
0x7fffffffffffffff, // ~63 bits
47+
// Use arithmetic to construct values below since they are not valid 'web
48+
// integers'. On platforms that use doubles to represent integers, there will
49+
// be some rounding in the arithmetic, testing a nearby value instead.
50+
0x20000000000000 + 1, // first integer not representable as double.
51+
0x20000000000000 + 2,
52+
0x7ffffffffffff000 + 0xfff, // ~63 bits
5053
0x8000000000000000,
51-
0x8000000000000001,
52-
0xffffffffffffffff, // ~64 bits
54+
0x8000000000000000 + 1,
55+
0xfffffffffffff000 + 0xfff, // ~64 bits
5356
// Doubles.
5457
0.0,
55-
5e-324, // min positive
56-
2.225073858507201e-308, // max denormal
57-
2.2250738585072014e-308, // min normal
58-
0.49999999999999994, // ~0.5
58+
5e-324, // min positive
59+
2.225073858507201e-308, // max denormal
60+
2.2250738585072014e-308, // min normal
61+
0.49999999999999994, // ~0.5
5962
0.5,
6063
0.5000000000000001,
61-
0.9999999999999999, // ~1.0
64+
0.9999999999999999, // ~1.0
6265
1.0,
6366
1.0000000000000002,
64-
4294967295.0, // ~32 bits
67+
4294967295.0, // ~32 bits
6568
4294967296.0,
66-
4503599627370495.5, // max fractional
69+
4503599627370495.5, // max fractional
6770
4503599627370497.0,
6871
9007199254740991.0,
69-
9007199254740992.0, // max exact (+1 is not a double)
70-
1.7976931348623157e+308, // max finite double
71-
1.0 / 0.0, // Infinity
72-
0.0 / 0.0, // NaN
72+
9007199254740992.0, // max exact (+1 is not a double)
73+
1.7976931348623157e+308, // max finite double
74+
1.0 / 0.0, // Infinity
75+
0.0 / 0.0, // NaN
7376
];
7477

7578
main() {

0 commit comments

Comments
 (0)