Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
test: move tests requiring the VM to their own test file
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed Jul 10, 2018
1 parent f51d120 commit 13323fd
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 20 deletions.
20 changes: 0 additions & 20 deletions test/int64_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -689,24 +689,6 @@ void main() {
expect(new Int64(4503599627370496).toInt(), 4503599627370496);
expect(new Int64(-4503599627370495).toInt(), -4503599627370495);
expect(new Int64(-4503599627370496).toInt(), -4503599627370496);
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("toInt32", () {
Expand Down Expand Up @@ -763,8 +745,6 @@ void main() {
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
});

group("parse", () {
Expand Down
47 changes: 47 additions & 0 deletions test/int_64_vm_test.dart
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
});
}

0 comments on commit 13323fd

Please sign in to comment.