[corelib_2] fix bigint_from_test for web platforms

Change-Id: Ib97814ba6b30822296c24026ddcd09f119508ed7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108422
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This commit is contained in:
Stephen Adams 2019-07-09 18:25:52 +00:00 committed by commit-bot@chromium.org
parent ad6b1ebbd6
commit 803658a6d8

View file

@ -64,6 +64,12 @@ main() {
testInt(int n) {
var bigint = new BigInt.from(n);
Expect.equals(n, bigint.toInt());
// If the integers are inexact (e.g. > 2^53 when represented by doubles as
// when compiled to JavaScript numbers) then the 'toString' might be rounded
// to the nearest equivalent 'nicer looking' number.
if (n == n + 1 || n == n - 1) return;
Expect.equals("$n", "$bigint");
}