Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1629)

Side by Side Diff: pkg/math/test/invert_test.dart

Issue 475463005: Implement math.gcd in dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/math/test/gcdext_test.dart ('k') | pkg/math/test/lcm_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « pkg/math/test/gcdext_test.dart ('k') | pkg/math/test/lcm_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698