aboutsummaryrefslogtreecommitdiff
path: root/test/ufuzz
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-01-06 11:26:15 +0800
committerGitHub <noreply@github.com>2020-01-06 11:26:15 +0800
commit0ff607cb8087acfa2da982cf9a00cd9463f98207 (patch)
treea38d4b92ba11267b657f969d9b549c253a827b5d /test/ufuzz
parent1988495d712c4eeabd89068b4da3420e2e5eb50f (diff)
downloadtracifyjs-0ff607cb8087acfa2da982cf9a00cd9463f98207.tar.gz
tracifyjs-0ff607cb8087acfa2da982cf9a00cd9463f98207.zip
improve `ufuzz` false positive detection (#3670)
Diffstat (limited to 'test/ufuzz')
-rw-r--r--test/ufuzz/index.js9
1 files 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 {