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**
|
**Key Changes**
|
||||||
- Concat connections
|
- Concat connections
|
||||||
|
|
||||||
@ -34,12 +34,18 @@ https://discord.gg/U8UspuA
|
|||||||
|
|
||||||
Planned features/TODO
|
Planned features/TODO
|
||||||
---------------------
|
---------------------
|
||||||
- [ ] Create test suite (In progress, mostly done)
|
- [x] Create test suite (In progress, mostly done)
|
||||||
- [ ] Network Parallelism rework
|
- [ ] Network Parallelism rework
|
||||||
|
|
||||||
Usage: [Check out the documentation for more info](https://github.com/rayaman/multi/blob/master/Documentation.md)
|
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
|
```lua
|
||||||
local multi, thread = require("multi"):init()
|
local multi, thread = require("multi"):init()
|
||||||
GLOBAL, THREAD = require("multi.integration.threading"):init()
|
GLOBAL, THREAD = require("multi.integration.threading"):init()
|
||||||
|
|||||||
@ -1,2 +1,7 @@
|
|||||||
|
require("runtests")
|
||||||
require("threadtests")
|
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 multi, thread = require("multi"):init{print=true}--{priority=true}
|
||||||
local good = false
|
local good = false
|
||||||
local proc = multi:newProcessor("Test",true)
|
local proc = multi:newProcessor("Test")
|
||||||
|
|
||||||
|
proc.Start()
|
||||||
|
|
||||||
proc:newAlarm(3):OnRing(function()
|
proc:newAlarm(3):OnRing(function()
|
||||||
good = true
|
good = true
|
||||||
end)
|
end)
|
||||||
@ -163,23 +166,27 @@ runTest = thread:newFunction(function()
|
|||||||
end
|
end
|
||||||
c3 = false
|
c3 = false
|
||||||
c4 = false
|
c4 = false
|
||||||
d:Destroy()
|
conn3:Unconnect(d)
|
||||||
conn3:Fire()
|
conn3:Fire()
|
||||||
if c3 and not(c4) then
|
if c3 and not(c4) then
|
||||||
print("Connection Test 3: Ok")
|
print("Connection Test 3: Ok")
|
||||||
else
|
else
|
||||||
print("Connection Test 3: Error removing connection")
|
print("Connection Test 3: Error removing connection")
|
||||||
end
|
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)
|
end)
|
||||||
|
|
||||||
print(runTest().OnError(function(...)
|
runTest().OnError(function(...)
|
||||||
print("Error: Something went wrong with the test!")
|
print("Error: Something went wrong with the test!")
|
||||||
print(...)
|
print(...)
|
||||||
os.exit(1)
|
end)
|
||||||
end))
|
|
||||||
|
|
||||||
print("Pumping proc")
|
if not love then
|
||||||
while true do
|
multi:mainloop()
|
||||||
proc.run()
|
|
||||||
end
|
end
|
||||||
@ -7,6 +7,12 @@ local env
|
|||||||
if love then
|
if love then
|
||||||
GLOBAL, THREAD = require("multi.integration.loveManager"):init()
|
GLOBAL, THREAD = require("multi.integration.loveManager"):init()
|
||||||
env = LOVE
|
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
|
else
|
||||||
io.write("Test Pseudo(p), Lanes(l), or love(Run in love environment) Threading: ")
|
io.write("Test Pseudo(p), Lanes(l), or love(Run in love environment) Threading: ")
|
||||||
choice = io.read()
|
choice = io.read()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user