Compare commits
No commits in common. "87f018ceea4653eef49b775beb62705a0cba7c8c" and "e9bb9c84680af652791c4135e9c2b1a3f5681af9" have entirely different histories.
87f018ceea
...
e9bb9c8468
1 changed files with 8 additions and 3 deletions
|
@ -98,7 +98,6 @@ 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)
|
||||||
|
@ -108,11 +107,9 @@ 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
|
||||||
|
@ -124,3 +121,11 @@ 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