This repository has been archived by the owner on Oct 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: move tests requiring the VM to their own test file
- Loading branch information
Showing
2 changed files
with
47 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
@TestOn('!js') | ||
|
||
import 'package:fixnum/fixnum.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group("conversions", () { | ||
test("toInt", () { | ||
expect(Int64.parseInt("-10000000000000000").toInt(), | ||
same(-10000000000000000)); | ||
expect(Int64.parseInt("-10000000000000001").toInt(), | ||
same(-10000000000000001)); | ||
expect(Int64.parseInt("-10000000000000002").toInt(), | ||
same(-10000000000000002)); | ||
expect(Int64.parseInt("-10000000000000003").toInt(), | ||
same(-10000000000000003)); | ||
expect(Int64.parseInt("-10000000000000004").toInt(), | ||
same(-10000000000000004)); | ||
expect(Int64.parseInt("-10000000000000005").toInt(), | ||
same(-10000000000000005)); | ||
expect(Int64.parseInt("-10000000000000006").toInt(), | ||
same(-10000000000000006)); | ||
expect(Int64.parseInt("-10000000000000007").toInt(), | ||
same(-10000000000000007)); | ||
expect(Int64.parseInt("-10000000000000008").toInt(), | ||
same(-10000000000000008)); | ||
}); | ||
}); | ||
|
||
test("", () { | ||
check(int n) { | ||
// Sign change should commute with conversion. | ||
expect(-new Int64(-n), new Int64(n)); | ||
expect(new Int64(-n), -new Int64(n)); | ||
} | ||
|
||
check(10); | ||
check(1000000000000000000); | ||
check(9223372000000000000); // near Int64.MAX_VALUE, has exact double value | ||
check(9223372036854775807); // Int64.MAX_VALUE, rounds up to -MIN_VALUE | ||
check(-9223372036854775808); // Int64.MIN_VALUE | ||
}); | ||
} |