From 0ff607cb8087acfa2da982cf9a00cd9463f98207 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Mon, 6 Jan 2020 11:26:15 +0800 Subject: improve `ufuzz` false positive detection (#3670) --- test/ufuzz/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js index dfa27ac0..36224667 100644 --- a/test/ufuzz/index.js +++ b/test/ufuzz/index.js @@ -1090,9 +1090,10 @@ function log(options) { } function fuzzy_match(original, uglified) { - original = original.split(" ", 5); - uglified = uglified.split(" ", 5); - for (var i = 0; i < 5; i++) { + uglified = uglified.split(" "); + var i = uglified.length; + original = original.split(" ", i); + while (--i >= 0) { if (original[i] === uglified[i]) continue; var a = +original[i]; var b = +uglified[i]; @@ -1128,7 +1129,7 @@ for (var round = 1; round <= num_iterations; round++) { ok = fuzzy_match(original_result, uglify_result); if (!ok) { var fuzzy_result = sandbox.run_code(original_code.replace(/( - 0\.1){3}/g, " - 0.3")); - ok = sandbox.same_stdout(fuzzy_result, uglify_result, o.toplevel); + ok = sandbox.same_stdout(fuzzy_result, uglify_result); } } } else { -- cgit v1.2.3