mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
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:
@@ -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;',
|
||||||
|
|||||||
Reference in New Issue
Block a user