mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 01:20:04 +00:00
Add unit test
This commit is contained in:
parent
1eb44b000f
commit
4a1e5167d5
1 changed files with 25 additions and 0 deletions
|
@ -487,6 +487,31 @@ TEST("world", function()
|
|||
|
||||
CHECK(count == 0)
|
||||
end
|
||||
|
||||
do CASE "should use the same functions for empty iteration where applicable"
|
||||
local world = jecs.World.new()
|
||||
local A = world:component()
|
||||
local B = world:component()
|
||||
|
||||
local e1 = world:entity()
|
||||
world:add(e1, A)
|
||||
|
||||
local query = world:query(B)
|
||||
CHECK(query.__iter == query.next)
|
||||
CHECK(query.next == query.replace)
|
||||
end
|
||||
|
||||
do CASE "should properly handle query:without for empty iteration"
|
||||
local world = jecs.World.new()
|
||||
local A = world:component()
|
||||
local B = world:component()
|
||||
|
||||
local e1 = world:entity()
|
||||
world:add(e1, A)
|
||||
|
||||
local query = world:query(B)
|
||||
CHECK(query == query:without())
|
||||
end
|
||||
end)
|
||||
|
||||
FINISH()
|
||||
|
|
Loading…
Reference in a new issue