mirror of
https://github.com/rayaman/multi.git
synced 2026-09-05 07:27:35 -04:00
Modified tests to make it more seamless
This commit is contained in:
+6
-1
@@ -1,2 +1,7 @@
|
||||
require("runtests")
|
||||
require("threadtests")
|
||||
-- Allows you to run "love tests" which runs the tests
|
||||
-- Allows you to run "love tests" which runs the tests
|
||||
|
||||
function love.update()
|
||||
multi:uManager()
|
||||
end
|
||||
+16
-9
@@ -22,7 +22,10 @@ end
|
||||
]]
|
||||
local multi, thread = require("multi"):init{print=true}--{priority=true}
|
||||
local good = false
|
||||
local proc = multi:newProcessor("Test",true)
|
||||
local proc = multi:newProcessor("Test")
|
||||
|
||||
proc.Start()
|
||||
|
||||
proc:newAlarm(3):OnRing(function()
|
||||
good = true
|
||||
end)
|
||||
@@ -163,23 +166,27 @@ runTest = thread:newFunction(function()
|
||||
end
|
||||
c3 = false
|
||||
c4 = false
|
||||
d:Destroy()
|
||||
conn3:Unconnect(d)
|
||||
conn3:Fire()
|
||||
if c3 and not(c4) then
|
||||
print("Connection Test 3: Ok")
|
||||
else
|
||||
print("Connection Test 3: Error removing connection")
|
||||
end
|
||||
os.exit() -- End of tests
|
||||
if not love then
|
||||
print("Testing pseudo threading")
|
||||
os.execute("lua tests/threadtests.lua p")
|
||||
print("Testing lanes threading")
|
||||
os.execute("lua tests/threadtests.lua l")
|
||||
os.exit()
|
||||
end
|
||||
end)
|
||||
|
||||
print(runTest().OnError(function(...)
|
||||
runTest().OnError(function(...)
|
||||
print("Error: Something went wrong with the test!")
|
||||
print(...)
|
||||
os.exit(1)
|
||||
end))
|
||||
end)
|
||||
|
||||
print("Pumping proc")
|
||||
while true do
|
||||
proc.run()
|
||||
if not love then
|
||||
multi:mainloop()
|
||||
end
|
||||
@@ -7,6 +7,12 @@ local env
|
||||
if love then
|
||||
GLOBAL, THREAD = require("multi.integration.loveManager"):init()
|
||||
env = LOVE
|
||||
elseif arg[1] == "l" then
|
||||
GLOBAL, THREAD = require("multi.integration.lanesManager"):init()
|
||||
env = LANES
|
||||
elseif arg[1] == "p" then
|
||||
GLOBAL, THREAD = require("multi.integration.pseudoManager"):init()
|
||||
env = PSEUDO
|
||||
else
|
||||
io.write("Test Pseudo(p), Lanes(l), or love(Run in love environment) Threading: ")
|
||||
choice = io.read()
|
||||
|
||||
Reference in New Issue
Block a user