Merge pull request #2 from yoyoyvr/dev.unit-test-precision

fix: unit tests were using strict equality testing for numeric results; now check 15 decimals
This commit is contained in:
Neil Fraser
2014-10-30 11:20:54 -07:00

View File

@@ -86,6 +86,8 @@ Blockly.JavaScript['unittest_main'].defineAssert_ = function(block) {
' function equals(a, b) {', ' function equals(a, b) {',
' if (a === b) {', ' if (a === b) {',
' return true;', ' return true;',
' } else if ((typeof a == "number") && (typeof b == "number") && (a.toPrecision(15) == b.toPrecision(15))) {',
' return true;',
' } else if (a instanceof Array && b instanceof Array) {', ' } else if (a instanceof Array && b instanceof Array) {',
' if (a.length != b.length) {', ' if (a.length != b.length) {',
' return false;', ' return false;',