Modified tests to make it more seamless
This commit is contained in:
parent
0e6c30b478
commit
9e1d31fc2a
10
README.md
10
README.md
@ -1,4 +1,4 @@
|
||||
# Multi Version: 16.0.0
|
||||
# Multi Version: 16.0.0 Connecting the dots
|
||||
**Key Changes**
|
||||
- Concat connections
|
||||
|
||||
@ -34,12 +34,18 @@ https://discord.gg/U8UspuA
|
||||
|
||||
Planned features/TODO
|
||||
---------------------
|
||||
- [ ] Create test suite (In progress, mostly done)
|
||||
- [x] Create test suite (In progress, mostly done)
|
||||
- [ ] Network Parallelism rework
|
||||
|
||||
Usage: [Check out the documentation for more info](https://github.com/rayaman/multi/blob/master/Documentation.md)
|
||||
-----
|
||||
|
||||
You can run tests in 2 ways:
|
||||
```
|
||||
lua tests/runtests.lua (Runs all tests, attempts to use lanes)
|
||||
love tests (Runs all tests in love2d env)
|
||||
```
|
||||
|
||||
```lua
|
||||
local multi, thread = require("multi"):init()
|
||||
GLOBAL, THREAD = require("multi.integration.threading"):init()
|
||||
|
||||
@ -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
|
||||
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user