Permalink
Browse files

Fix NaN === NaN tester

  • Loading branch information...
1 parent 1b5a023 commit 170cd7a413cc5242d97b0da6fe6bb2502f9c7615 @yurydelendik yurydelendik committed Apr 28, 2012
Showing with 5 additions and 2 deletions.
  1. +1 −1 src/avm1/tests/test.interpreter.js
  2. +4 −1 utils/avm1tests/TestCase.as
@@ -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 + ' / ';
@@ -4,20 +4,23 @@ 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() { }
static function test(testCases) {
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);

0 comments on commit 170cd7a

Please sign in to comment.