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

Unified Diff: tests/lib/math/math_package_bigint_test.dart

Issue 475463005: Implement math.gcd in dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move gcd to pkg/math; move tests; fix implementation; split bigint tests Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: tests/lib/math/math_package_bigint_test.dart
diff --git a/tests/lib/math/math_package_bigint_test.dart b/tests/lib/math/math_package_bigint_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e302c7152bbb4f565067e51ad4c67b9f1e92e22b
--- /dev/null
+++ b/tests/lib/math/math_package_bigint_test.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2011, 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.
+
+library math_test;
+import "package:expect/expect.dart";
+import 'dart:math';
+import 'package:math/math.dart';
Lasse Reichstein Nielsen 2014/08/20 12:17:02 Test of package functionality should go in the pac
srawlins 2014/08/25 05:43:54 Done.
+
+// See math_package_test.dart first. This file contains only the tests that
+// need Bigint or would fail in dart2js compatibility mode.
+
+class MathPackageBigintTest {
Lasse Reichstein Nielsen 2014/08/20 12:17:02 No need for a class here, or a testMain method, ju
srawlins 2014/08/25 05:43:54 Done.
+ static void testGcdWithBigints() {
+ Expect.equals(pow(2, 63)*3, gcd(pow(2, 64)*3*5, pow(2,63)*3*7));
+ // 595056260442243647 is the first prime after 2**64 / 31.
+ Expect.equals(595056260442243647,
+ gcd(31*595056260442243647, 37*595056260442243647));
+ }
+
+ static testMain() {
+ testGcdWithBigints();
+ }
+}
+
+main() {
+ MathPackageBigintTest.testMain();
+}

Powered by Google App Engine
This is Rietveld 408576698