Skip to content

Commit 38c5766

Browse files
committed
fix: unit tests were using strict equality testing for numeric results. Modified to check for 15 decimals of precision. Now the exp unit test passes.
1 parent 6539211 commit 38c5766

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/generators/unittest_javascript.js

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ Blockly.JavaScript['unittest_main'].defineAssert_ = function(block) {
8686
' function equals(a, b) {',
8787
' if (a === b) {',
8888
' return true;',
89+
' } else if ((typeof a == "number") && (typeof b == "number") && (a.toPrecision(15) == b.toPrecision(15))) {',
90+
' return true;',
8991
' } else if (a instanceof Array && b instanceof Array) {',
9092
' if (a.length != b.length) {',
9193
' return false;',

0 commit comments

Comments
 (0)