mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 17:40:02 +00:00
Add test
This commit is contained in:
parent
6ab5606846
commit
05e00417e4
1 changed files with 23 additions and 1 deletions
|
@ -389,7 +389,7 @@ TEST("world", function()
|
||||||
CHECK(count == 2)
|
CHECK(count == 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
do CASE "should be able to add matching entity during iteration"
|
do CASE "should be able to add/remove matching entity during iteration"
|
||||||
local world = jecs.World.new()
|
local world = jecs.World.new()
|
||||||
local Name = world:component()
|
local Name = world:component()
|
||||||
for i = 1, 5 do
|
for i = 1, 5 do
|
||||||
|
@ -407,6 +407,28 @@ TEST("world", function()
|
||||||
end
|
end
|
||||||
CHECK(count == 5)
|
CHECK(count == 5)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
do CASE "should not overpopulate archetypes from A and AB"
|
||||||
|
local world = jecs.World.new()
|
||||||
|
local A = world:component()
|
||||||
|
local B = world:component()
|
||||||
|
|
||||||
|
local e1 = world:entity()
|
||||||
|
local e2 = world:entity()
|
||||||
|
world:add(e1, A)
|
||||||
|
world:add(e2, A)
|
||||||
|
world:add(e2, B)
|
||||||
|
|
||||||
|
local count = 0
|
||||||
|
for id in world:query(A) do
|
||||||
|
local e = world:entity()
|
||||||
|
world:add(e, A)
|
||||||
|
world:add(e, B)
|
||||||
|
count += 1
|
||||||
|
end
|
||||||
|
|
||||||
|
CHECK(count == 3)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
FINISH()
|
FINISH()
|
||||||
|
|
Loading…
Reference in a new issue