From: Dan Vanderkam Date: Mon, 13 Jun 2011 03:13:53 +0000 (-0400) Subject: fix NaN == NaN comparison in Asserts.js X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=36f47a31fa94a9cd06c6719c5c8ff033916b203d;p=dygraphs.git fix NaN == NaN comparison in Asserts.js --- diff --git a/auto_tests/lib/Asserts.js b/auto_tests/lib/Asserts.js index b3ed441..b06ff29 100644 --- a/auto_tests/lib/Asserts.js +++ b/auto_tests/lib/Asserts.js @@ -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;