mirror of
https://github.com/rayaman/multi.git
synced 2026-09-04 23:17:35 -04:00
Tests failing with connections * connections, not counting triggers properly
This commit is contained in:
+9
-6
@@ -2,7 +2,7 @@ if os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" then
|
||||
package.path="multi/?.lua;multi/?/init.lua;multi/?.lua;multi/?/?/init.lua;"..package.path
|
||||
require("lldebugger").start()
|
||||
else
|
||||
package.path="./?.lua;../?/init.lua;../?.lua;../?/?/init.lua;"..package.path
|
||||
package.path = "../?/init.lua;../?.lua;"..package.path
|
||||
end
|
||||
--[[
|
||||
This file runs all tests.
|
||||
@@ -36,12 +36,12 @@ runTest = thread:newFunction(function()
|
||||
end)
|
||||
proc:newTStep(1,10,1,.1):OnStep(function(t)
|
||||
tsteps = tsteps + 1
|
||||
end).OnEnd(function(step)
|
||||
end):OnEnd(function(step)
|
||||
step:Destroy()
|
||||
end)
|
||||
proc:newStep(1,10):OnStep(function(s)
|
||||
steps = steps + 1
|
||||
end).OnEnd(function(step)
|
||||
end):OnEnd(function(step)
|
||||
step:Destroy()
|
||||
end)
|
||||
local loop = proc:newLoop(function(l)
|
||||
@@ -102,6 +102,7 @@ runTest = thread:newFunction(function()
|
||||
ret3.OnStatus(function(part,whole)
|
||||
s3 = math.ceil((part/whole)*1000)/10
|
||||
end)
|
||||
|
||||
ret.OnReturn(function()
|
||||
print("Done 1")
|
||||
end)
|
||||
@@ -111,7 +112,9 @@ runTest = thread:newFunction(function()
|
||||
ret3.OnReturn(function()
|
||||
print("Done 3")
|
||||
end)
|
||||
local err, timeout = thread.hold(ret.OnReturn + ret2.OnReturn + ret3.OnReturn)
|
||||
|
||||
local err, timeout = thread.hold(ret.OnReturn * ret2.OnReturn * ret3.OnReturn)
|
||||
print("Working!",s1,s2,s3)
|
||||
if s1 == 100 and s2 == 100 and s3 == 100 then
|
||||
print("Threads: Ok")
|
||||
else
|
||||
@@ -164,11 +167,11 @@ runTest = thread:newFunction(function()
|
||||
os.exit() -- End of tests
|
||||
end)
|
||||
|
||||
runTest().OnError(function(...)
|
||||
print(runTest().OnError(function(...)
|
||||
print("Error: Something went wrong with the test!")
|
||||
print(...)
|
||||
os.exit(1)
|
||||
end)
|
||||
end))
|
||||
|
||||
print("Pumping proc")
|
||||
while true do
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
package.path = "./?/init.lua;?.lua;lua5.4/share/lua/5.4/?/init.lua;lua5.4/share/lua/5.4/?.lua;"--..package.path
|
||||
package.cpath = "lua5.4/lib/lua/5.4/?/core.dll;"--..package.cpath
|
||||
package.path = "../?/init.lua;../?.lua;"..package.path
|
||||
multi, thread = require("multi"):init{print=true,findopt=true}
|
||||
GLOBAL, THREAD = require("multi.integration.lanesManager"):init()
|
||||
multi:getOptimizationConnection()(function(msg)
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
function difference(a, b)
|
||||
local ai = {}
|
||||
local r = {}
|
||||
local rr = {}
|
||||
for k,v in pairs(a) do r[k] = v; ai[v]=true end
|
||||
for k,v in pairs(b) do
|
||||
if ai[v]==nil then table.insert(rr,r[k]) end
|
||||
end
|
||||
return rr
|
||||
end
|
||||
function remove(a, b)
|
||||
local ai = {}
|
||||
local r = {}
|
||||
for k,v in pairs(a) do ai[v]=true end
|
||||
for k,v in pairs(b) do
|
||||
if ai[v]==nil then table.insert(r,a[k]) end
|
||||
end
|
||||
return r
|
||||
end
|
||||
|
||||
function printtab(tab,msg)
|
||||
print(msg or "TABLE")
|
||||
for i,v in pairs(tab) do
|
||||
print(i, v)
|
||||
end
|
||||
print("")
|
||||
end
|
||||
|
||||
local tab1 = {1,2,3,4,5}
|
||||
local tab2 = {3,4,5,6,7}
|
||||
tab1 = remove(tab1,tab2)
|
||||
printtab(tab1, "Table 1")
|
||||
printtab(tab2, "Table 2")
|
||||
Reference in New Issue
Block a user