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

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

Issue 2247553002: Fix a test to not expect NaNs to be bitwise identical. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: can't use == with NaN Created 4 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
« no previous file with comments | « tests/lib/lib.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/math/double_pow_test.dart
diff --git a/tests/lib/math/double_pow_test.dart b/tests/lib/math/double_pow_test.dart
index 83a8ecea99790e814503af74d9b5ebad74bf029e..f1071c49ceb7fccc45a2baf58e475184b9d01eee 100644
--- a/tests/lib/math/double_pow_test.dart
+++ b/tests/lib/math/double_pow_test.dart
@@ -117,6 +117,13 @@ test() {
}
// if `x` is -Infinity or -0.0 and `y` is not an odd integer, then the
// result is the same as `pow(-x , y)`.
+ if (d.isNaN) {
+ Expect.isTrue(pow(Infinity, d).isNaN);
+ Expect.isTrue(pow(-Infinity, d).isNaN);
+ Expect.isTrue(pow(0.0, d).isNaN);
+ Expect.isTrue(pow(-0.0, d).isNaN);
+ continue;
+ }
Expect.identical(pow(Infinity, d), pow(-Infinity, d));
Expect.identical(pow(0.0, d), pow(-0.0, d));
}
@@ -136,7 +143,12 @@ test() {
Expect.identical(1.0, pow(d, Infinity));
}
// if `y` is -Infinity, the result is `1/pow(x, Infinity)`.
- Expect.identical(1/pow(d, Infinity), pow(d, -Infinity));
+ if (d.isNaN) {
+ Expect.isTrue((1/pow(d, Infinity)).isNaN);
+ Expect.isTrue(pow(d, -Infinity).isNaN);
+ } else {
+ Expect.identical(1/pow(d, Infinity), pow(d, -Infinity));
+ }
}
// Some non-exceptional values.
@@ -159,4 +171,4 @@ test() {
main() {
for (int i = 0; i < 10; i++) test();
-}
+}
« no previous file with comments | « tests/lib/lib.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698