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

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

Issue 24911003: Revert "Reinstate type checks in Math.min and Math.max" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/math/math.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/math/min_max_test.dart
diff --git a/tests/lib/math/min_max_test.dart b/tests/lib/math/min_max_test.dart
index a2ce160b9421f29fc8fe6debe2cc33b8e1732097..46d05665e7af66f3d93457b953aab0099d9cbd92 100644
--- a/tests/lib/math/min_max_test.dart
+++ b/tests/lib/math/min_max_test.dart
@@ -11,27 +11,10 @@ import 'dart:math';
var inf = double.INFINITY;
var nan = double.NAN;
-// A class that might work if [min] and [max] worked for non-numbers.
-class Wrap implements Comparable {
- final value;
- Wrap(this.value);
- int compare(Wrap other) => value.compare(other.value);
- bool operator<(Wrap other) => compare(other) < 0;
- bool operator<=(Wrap other) => compare(other) <= 0;
- bool operator>(Wrap other) => compare(other) > 0;
- bool operator>=(Wrap other) => compare(other) >= 0;
- bool operator==(other) => other is Wrap && compare(other) == 0;
- String toString() => 'Wrap($value)';
-}
-
-var wrap1 = new Wrap(1);
-var wrap2 = new Wrap(2);
-
testMin() {
testMin1();
testMin2();
testMin3();
- testMinChecks();
}
testMin1() {
@@ -296,18 +279,10 @@ testMin3() {
Expect.isFalse(min(inf, inf).isNegative);
}
-testMinChecks() {
- // Min and max work only on numbers.
- Expect.throws(() => min(wrap1, wrap2), (e) => e is ArgumentError);
- Expect.throws(() => min(wrap1, 0), (e) => e is ArgumentError);
- Expect.throws(() => min(0, wrap2), (e) => e is ArgumentError);
-}
-
testMax() {
testMax1();
testMax2();
testMax3();
- testMaxChecks();
}
testMax1() {
@@ -562,13 +537,6 @@ testMax3() {
Expect.isTrue(max(-inf, -inf).isNegative);
}
-testMaxChecks() {
- // Min and max work only on numbers.
- Expect.throws(() => min(wrap1, wrap2), (e) => e is ArgumentError);
- Expect.throws(() => min(wrap1, 0), (e) => e is ArgumentError);
- Expect.throws(() => min(0, wrap2), (e) => e is ArgumentError);
-}
-
main() {
testMin();
testMin();
« no previous file with comments | « sdk/lib/math/math.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698