Skip to content

Commit

Permalink
Collapse if statements, missed spots from other commits
Browse files Browse the repository at this point in the history
  • Loading branch information
DerelictDrone committed Dec 12, 2023
1 parent e6b3431 commit 77b75b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lua/wire/zvm/tests/example.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ end
function CPUTest.RunCPU()
CPUTest.TestSuite.FlashData(CPUTest.VM, CPUTest.TestSuite.GetCompileBuffer()) -- upload compiled to virtual cpu
CPUTest.VM.Clk = 1
for i=0,4096 do
for i = 0, 4096 do
CPUTest.VM:RunStep()
end
-- False = no error, True = error
Expand Down
2 changes: 1 addition & 1 deletion lua/wire/zvm/tests/ifdefs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function CPUTest.LogResults()
end

function CPUTest.CompareResults()
local fail,results1,results2 = false, {}, {}
local fail, results1, results2 = false, {}, {}
for ind, i in ipairs(CPUTest.ExpectedVariations1) do
if CPUTest.ResultVariations1[ind] == "Test " .. i then
results1[ind] = true
Expand Down
11 changes: 5 additions & 6 deletions lua/wire/zvm/zvm_tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include("wire/client/hlzasm/hc_compiler.lua")

local color_white = Color(255,255,255)
local color_red = Color(255,0,0)
local color_blue = Color(0,0,255)

ZVMTestSuite = {
TestFiles = {},
Expand All @@ -30,13 +31,11 @@ function ZVMTestSuite.CMDRun(_, _, _, names)
ZVMTestSuite.TestFiles[#ZVMTestSuite.TestFiles+1] = i
end
end
if #ZVMTestSuite.TestFiles == 0 then
if names ~= nil then
if #ZVMTestSuite.TestFiles == 0 and names ~= nil then
if names ~= "" then
print("Didn't find any tests with name(s): " .. names)
return
end
end
ZVMTestSuite.RunAll()
else
PrintTable(ZVMTestSuite.TestFiles)
Expand Down Expand Up @@ -85,7 +84,7 @@ function ZVMTestSuite.FinishTest(fail)
passed = passed + 1
end
end
local passmod, errormod, warnstring = "","",""
local passmod, errormod, warnstring = "", "", ""
if passed ~= 1 then
passmod = "s"
end
Expand All @@ -111,7 +110,7 @@ function ZVMTestSuite.Error(...)
MsgC(color_white, tostring(args))
end
end
MsgC(Color(0,0,255), "\n")
MsgC(color_blue, "\n")
end

function ZVMTestSuite.RunNextTest()
Expand All @@ -138,7 +137,7 @@ function ZVMTestSuite.Compile(SourceCode, FileName, SuccessCallback, ErrorCallba
end

function ZVMTestSuite.InternalSuccessCallback()
HCOMP.LoadFile = ZVMTestSuite.HCOMPLoadFile
HCOMP.LoadFile = ZVMTestSuite.HCOMPLoadFile
HCOMP.Warning = ZVMTestSuite.OldHCOMPWarning
ZVMTestSuite.CompileArgs.SuccessCallback()
end
Expand Down

0 comments on commit 77b75b1

Please sign in to comment.