fix NaN == NaN comparison in Asserts.js
authorDan Vanderkam <dan@dygraphs.com>
Mon, 13 Jun 2011 03:13:53 +0000 (23:13 -0400)
committerDan Vanderkam <dan@dygraphs.com>
Mon, 13 Jun 2011 03:13:53 +0000 (23:13 -0400)
auto_tests/lib/Asserts.js

index b3ed441..b06ff29 100644 (file)
@@ -178,6 +178,11 @@ function compare_(expected, actual) {
     return false;
   }
 
+  if (isNaN(expected) && isNaN(actual)) {
+    // This has to be special-cased because (NaN === NaN) == false.
+    return true;
+  }
+
   var key = null;
   var actualLength   = 0;
   var expectedLength = 0;