| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library Int32test; | 5 library Int32test; |
| 6 import 'package:fixnum/fixnum.dart'; | 6 import 'package:fixnum/fixnum.dart'; |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
| 8 | 8 |
| 9 void main() { | 9 void main() { |
| 10 group("isX tests", () { | 10 group("isX tests", () { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 expect(Int32.MAX_VALUE.bitLength, 31); | 49 expect(Int32.MAX_VALUE.bitLength, 31); |
| 50 expect(Int32.MIN_VALUE.bitLength, 31); | 50 expect(Int32.MIN_VALUE.bitLength, 31); |
| 51 }); | 51 }); |
| 52 }); | 52 }); |
| 53 | 53 |
| 54 group("arithmetic operators", () { | 54 group("arithmetic operators", () { |
| 55 Int32 n1 = new Int32(1234); | 55 Int32 n1 = new Int32(1234); |
| 56 Int32 n2 = new Int32(9876); | 56 Int32 n2 = new Int32(9876); |
| 57 Int32 n3 = new Int32(-1234); | 57 Int32 n3 = new Int32(-1234); |
| 58 Int32 n4 = new Int32(-9876); | 58 Int32 n4 = new Int32(-9876); |
| 59 Int32 n5 = new Int32(0x12345678); | |
| 60 Int32 n6 = new Int32(0x22222222); | |
| 61 | 59 |
| 62 test("+", () { | 60 test("+", () { |
| 63 expect(n1 + n2, new Int32(11110)); | 61 expect(n1 + n2, new Int32(11110)); |
| 64 expect(n3 + n2, new Int32(8642)); | 62 expect(n3 + n2, new Int32(8642)); |
| 65 expect(n3 + n4, new Int32(-11110)); | 63 expect(n3 + n4, new Int32(-11110)); |
| 66 expect(Int32.MAX_VALUE + 1, Int32.MIN_VALUE); | 64 expect(Int32.MAX_VALUE + 1, Int32.MIN_VALUE); |
| 67 expect(() => new Int32(17) + null, throws); | 65 expect(() => new Int32(17) + null, throws); |
| 68 }); | 66 }); |
| 69 | 67 |
| 70 test("-", () { | 68 test("-", () { |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 expect(new Int32(-1).shiftRightUnsigned(8).toHexString(), "ffffff"); | 356 expect(new Int32(-1).shiftRightUnsigned(8).toHexString(), "ffffff"); |
| 359 }); | 357 }); |
| 360 }); | 358 }); |
| 361 | 359 |
| 362 group("toRadixString", () { | 360 group("toRadixString", () { |
| 363 test("returns base n string representation", () { | 361 test("returns base n string representation", () { |
| 364 expect(new Int32(123456789).toRadixString(5), "223101104124"); | 362 expect(new Int32(123456789).toRadixString(5), "223101104124"); |
| 365 }); | 363 }); |
| 366 }); | 364 }); |
| 367 } | 365 } |
| OLD | NEW |