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

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

Issue 20011002: Partitioned min_max_test for checked mode as well. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 | « no previous file | 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
===================================================================
--- tests/lib/math/min_max_test.dart (revision 25314)
+++ tests/lib/math/min_max_test.dart (working copy)
@@ -8,9 +8,13 @@
import "package:expect/expect.dart";
import 'dart:math';
+var inf = double.INFINITY;
+var nan = double.NAN;
+
testMin() {
testMin1();
testMin2();
+ testMin3();
}
testMin1() {
@@ -35,8 +39,6 @@
Expect.equals(-10.5, min(0.5, -10.5));
// Test matrix:
// NaN, -infinity, -499.0, -499, -0.0, 0.0, 0, 499.0, 499, +infinity.
- var inf = double.INFINITY;
- var nan = double.NAN;
Expect.isTrue(min(nan, nan).isNaN);
Expect.isTrue(min(nan, -inf).isNaN);
@@ -109,7 +111,9 @@
Expect.equals(-0.0, min(-0.0, 499));
Expect.equals(-0.0, min(-0.0, inf));
Expect.isTrue(min(-0.0, nan).isNaN);
+}
+testMin2() {
Expect.isTrue(min(-0.0, -499.0) is double);
Expect.isTrue(min(-0.0, -499) is int);
Expect.isTrue(min(-0.0, -0.0) is double);
@@ -176,11 +180,6 @@
Expect.isTrue(min(0, 499.0) is int);
Expect.isTrue(min(0, 499) is int);
Expect.isTrue(min(0, inf) is int);
-}
-
-testMin2() {
- var inf = double.INFINITY;
- var nan = double.NAN;
Expect.isTrue(min(0, -499.0).isNegative);
Expect.isTrue(min(0, -499).isNegative);
Expect.isTrue(min(0, -0.0).isNegative);
@@ -189,7 +188,9 @@
Expect.isFalse(min(0, 499.0).isNegative);
Expect.isFalse(min(0, 499).isNegative);
Expect.isFalse(min(0, inf).isNegative);
+}
+testMin3() {
Expect.equals(-inf, min(499.0, -inf));
Expect.equals(-499.0, min(499.0, -499.0));
Expect.equals(-499, min(499.0, -499));
@@ -281,6 +282,7 @@
testMax() {
testMax1();
testMax2();
+ testMax3();
}
testMax1() {
@@ -306,8 +308,6 @@
// Test matrix:
// NaN, infinity, 499.0, 499, 0.0, 0, -0.0, -499.0, -499, -infinity.
- var inf = double.INFINITY;
- var nan = double.NAN;
Expect.isTrue(max(nan, nan).isNaN);
Expect.isTrue(max(nan, -inf).isNaN);
@@ -389,7 +389,9 @@
Expect.isTrue(max(0.0, -499) is double);
Expect.isTrue(max(0.0, -499.0) is double);
Expect.isTrue(max(0.0, -inf) is double);
+}
+testMax2() {
Expect.isFalse(max(0.0, 0.0).isNegative);
Expect.isFalse(max(0.0, 0).isNegative);
Expect.isFalse(max(0.0, -0.0).isNegative);
@@ -445,10 +447,7 @@
Expect.isTrue(max(-0.0, -inf) is double);
}
-testMax2() {
- var inf = double.INFINITY;
- var nan = double.NAN;
-
+testMax3() {
Expect.isFalse(max(-0.0, 0.0).isNegative);
Expect.isFalse(max(-0.0, 0).isNegative);
Expect.isTrue(max(-0.0, -0.0).isNegative);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698