From 170cd7a413cc5242d97b0da6fe6bb2502f9c7615 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Fri, 27 Apr 2012 22:22:20 -0500 Subject: [PATCH] Fix NaN === NaN tester --- src/avm1/tests/test.interpreter.js | 2 +- utils/avm1tests/TestCase.as | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/avm1/tests/test.interpreter.js b/src/avm1/tests/test.interpreter.js index 5ab6bdaa1..427afb7ab 100644 --- a/src/avm1/tests/test.interpreter.js +++ b/src/avm1/tests/test.interpreter.js @@ -87,7 +87,7 @@ describe('AVM1 Interpreter (Tamarin acceptance tests)', function() { if (results.failed) { var testCases = results.testCases; for (var q = 0; q < testCases.length; q++) { - if (testCases[q].expect === testCases[q].actual) continue; + if (!testCases[q].failed) continue; reason += '#' + q + ' | ' + testCases[q].description + ' | ' + testCases[q].reason + ' | ' + testCases[q].expect + ' != ' + testCases[q].actual + ' / '; diff --git a/utils/avm1tests/TestCase.as b/utils/avm1tests/TestCase.as index c7decc664..866647327 100644 --- a/utils/avm1tests/TestCase.as +++ b/utils/avm1tests/TestCase.as @@ -4,12 +4,14 @@ class TestCase { var reason; var expect; var actual; + var failed; function TestCase(sectionName, description, expect, actual) { this.sectionName = sectionName; this.description = description; this.reason = ''; this.expect = expect; this.actual = actual; + this.failed = true; } static function startTest() { } @@ -17,7 +19,8 @@ class TestCase { var atLeastOneFailed = false; for (var i = 0; i < testCases.length; i++) { var tc = testCases[i]; - var failed = tc.expect !== tc.actual; + var failed = !(tc.expect === tc.actual || (isNaN(tc.expect) && isNaN(tc.actual))); + tc.failed = failed; log('Test case #' + i + ' | ' + tc.expect + (failed ? ' != ' : ' == ') + tc.actual + ' | ' + tc.sectionName + ' | ' + tc.reason);