Skip to content

Commit 052874e

Browse files
rakudramacommit-bot@chromium.org
authored andcommitted
Avoid non-web integer literal in corelib_2/int_round_test
Also fix precedence bug. Change-Id: I4b4746e0adfd0ff354d85519665ae23742f8703a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107838 Auto-Submit: Stephen Adams <[email protected]> Reviewed-by: Lasse R.H. Nielsen <[email protected]> Commit-Queue: Stephen Adams <[email protected]>
1 parent 4803371 commit 052874e

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

tests/corelib_2/corelib_2.status

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ int_parse_radix_int64_test/01: CompileTimeError, OK # Error if web int literal c
3838
int_parse_radix_int64_test/02: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
3939
int_parse_radix_int64_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
4040
int_parse_radix_test/01: RuntimeError
41-
int_round_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
4241
int_round_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
4342
int_to_int_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
4443
int_truncate_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
@@ -323,7 +322,6 @@ int_parse_radix_int64_test/02: CompileTimeError, OK # Error if web int literal c
323322
int_parse_radix_int64_test/none: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
324323
int_parse_radix_test/01: RuntimeError # Issue 29921
325324
int_parse_with_limited_ints_test: Skip # Requires fixed-size int64 support.
326-
int_round_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
327325
int_round_to_double_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
328326
int_to_int_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
329327
int_truncate_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351

tests/corelib_2/int_round_test.dart

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,29 @@
55
import 'package:expect/expect.dart';
66

77
main() {
8+
const int big = 0x123456789AB0000 + 0xCDEF; // truncating arithmetic on web.
9+
810
Expect.equals(0, 0.round());
911
Expect.equals(1, 1.round());
1012
Expect.equals(0x1234, 0x1234.round());
1113
Expect.equals(0x12345678, 0x12345678.round());
1214
Expect.equals(0x123456789AB, 0x123456789AB.round());
13-
Expect.equals(0x123456789ABCDEF, 0x123456789ABCDEF.round());
14-
Expect.equals(-1, -1.round());
15-
Expect.equals(-0x1234, -0x1234.round());
16-
Expect.equals(-0x12345678, -0x12345678.round());
17-
Expect.equals(-0x123456789AB, -0x123456789AB.round());
18-
Expect.equals(-0x123456789ABCDEF, -0x123456789ABCDEF.round());
15+
Expect.equals(big, big.round());
16+
Expect.equals(-1, (-1).round());
17+
Expect.equals(-0x1234, (-0x1234).round());
18+
Expect.equals(-0x12345678, (-0x12345678).round());
19+
Expect.equals(-0x123456789AB, (-0x123456789AB).round());
20+
Expect.equals(-big, (-big).round());
1921

2022
Expect.isTrue(0.round() is int);
2123
Expect.isTrue(1.round() is int);
2224
Expect.isTrue(0x1234.round() is int);
2325
Expect.isTrue(0x12345678.round() is int);
2426
Expect.isTrue(0x123456789AB.round() is int);
25-
Expect.isTrue(0x123456789ABCDEF.round() is int);
26-
Expect.isTrue(-1.round() is int);
27-
Expect.isTrue(-0x1234.round() is int);
28-
Expect.isTrue(-0x12345678.round() is int);
29-
Expect.isTrue(-0x123456789AB.round() is int);
30-
Expect.isTrue(-0x123456789ABCDEF.round() is int);
27+
Expect.isTrue(big.round() is int);
28+
Expect.isTrue((-1).round() is int);
29+
Expect.isTrue((-0x1234).round() is int);
30+
Expect.isTrue((-0x12345678).round() is int);
31+
Expect.isTrue((-0x123456789AB).round() is int);
32+
Expect.isTrue((-big).round() is int);
3133
}

0 commit comments

Comments
 (0)