OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 library math_test; |
| 6 import "package:expect/expect.dart"; |
| 7 import 'dart:math'; |
| 8 import 'package:math/math.dart'; |
| 9 |
| 10 void testInvert() { |
| 11 Expect.equals(1, invert(1, 7)); |
| 12 Expect.equals(4, invert(2, 7)); |
| 13 Expect.equals(5, invert(3, 7)); |
| 14 Expect.equals(2, invert(4, 7)); |
| 15 Expect.equals(3, invert(5, 7)); |
| 16 Expect.equals(6, invert(6, 7)); |
| 17 |
| 18 Expect.throws(() => invert(0, null), (e) => e is ArgumentError); |
| 19 Expect.throws(() => invert(null, 0), (e) => e is ArgumentError); |
| 20 Expect.throws(() => invert(0, 7), (e) => e is IntegerDivisionByZeroException); |
| 21 Expect.throws(() => invert(3, 6), (e) => e is IntegerDivisionByZeroException); |
| 22 Expect.throws(() => invert(6, 3), (e) => e is IntegerDivisionByZeroException); |
| 23 Expect.throws(() => invert(6, 0), (e) => e is IntegerDivisionByZeroException); |
| 24 |
| 25 // Medium int (mint) arguments. |
| 26 Expect.equals(7291109880702, invert(1000, 9079837958533)); |
| 27 Expect.equals(6417656708605, invert(1000000, 9079837958533)); |
| 28 } |
| 29 |
| 30 main() { |
| 31 testInvert(); |
| 32 } |
OLD | NEW |