mirror of
https://github.com/google/blockly.git
synced 2026-01-06 08:30:13 +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) {',
|
||||
' if (a === b) {',
|
||||
' 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) {',
|
||||
' if (a.length != b.length) {',
|
||||
' return false;',
|
||||
|
||||
Reference in New Issue
Block a user