Compare commits
2 commits
e9bb9c8468
...
87f018ceea
Author | SHA1 | Date | |
---|---|---|---|
87f018ceea | |||
375246159d |
1 changed files with 3 additions and 8 deletions
|
@ -98,6 +98,7 @@ local function is_safe(report)
|
||||||
return unsafe, unsafe_idx_1, unsafe_idx_2
|
return unsafe, unsafe_idx_1, unsafe_idx_2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Copy the report, remove the specified index, and test if it is safe
|
||||||
local function test_altered_report(report, idx)
|
local function test_altered_report(report, idx)
|
||||||
local test_report = table.shallow_copy(report)
|
local test_report = table.shallow_copy(report)
|
||||||
table.remove(test_report, idx)
|
table.remove(test_report, idx)
|
||||||
|
@ -107,9 +108,11 @@ end
|
||||||
|
|
||||||
local safe_count = 0
|
local safe_count = 0
|
||||||
for _, report in ipairs(reports) do
|
for _, report in ipairs(reports) do
|
||||||
|
-- if unsafe == true, idx1 and idx2 will be null
|
||||||
local unsafe, idx1, idx2 = is_safe(report)
|
local unsafe, idx1, idx2 = is_safe(report)
|
||||||
|
|
||||||
if unsafe then
|
if unsafe then
|
||||||
|
-- if the report is unsafe, generate 2 reports with the potentially bad values removed, and test them again
|
||||||
if not test_altered_report(report, idx1) or not test_altered_report(report, idx2) then
|
if not test_altered_report(report, idx1) or not test_altered_report(report, idx2) then
|
||||||
unsafe = false
|
unsafe = false
|
||||||
end
|
end
|
||||||
|
@ -121,11 +124,3 @@ for _, report in ipairs(reports) do
|
||||||
end
|
end
|
||||||
|
|
||||||
print(safe_count)
|
print(safe_count)
|
||||||
|
|
||||||
local function test()
|
|
||||||
return true, nil, nil
|
|
||||||
end
|
|
||||||
|
|
||||||
if test() then
|
|
||||||
print("uwu")
|
|
||||||
end
|
|
||||||
|
|
Loading…
Reference in a new issue