mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 01:20:04 +00:00
Adding test
This commit is contained in:
parent
77d1403711
commit
cea5798d49
1 changed files with 20 additions and 0 deletions
|
@ -82,6 +82,7 @@ return function()
|
||||||
expect(world:get(id, B)).to.equal(1)
|
expect(world:get(id, B)).to.equal(1)
|
||||||
expect(world:get(id1, A)).to.equal("hello")
|
expect(world:get(id1, A)).to.equal("hello")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("should remove component", function()
|
it("should remove component", function()
|
||||||
local id = world:entity()
|
local id = world:entity()
|
||||||
world:set(id, A, true)
|
world:set(id, A, true)
|
||||||
|
@ -90,6 +91,7 @@ return function()
|
||||||
|
|
||||||
expect(world:get(id, A)).to.equal(nil)
|
expect(world:get(id, A)).to.equal(nil)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("should override component data", function()
|
it("should override component data", function()
|
||||||
|
|
||||||
local id = world:entity()
|
local id = world:entity()
|
||||||
|
@ -100,6 +102,23 @@ return function()
|
||||||
expect(world:get(id, A)).to.equal(false)
|
expect(world:get(id, A)).to.equal(false)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("should not query a removed component", function()
|
||||||
|
local Tag = world:entity()
|
||||||
|
local AnotherTag = world:entity()
|
||||||
|
|
||||||
|
local entity = world:entity()
|
||||||
|
world:set(entity, Tag)
|
||||||
|
world:set(entity, AnotherTag)
|
||||||
|
world:remove(entity, AnotherTag)
|
||||||
|
|
||||||
|
local added = 0
|
||||||
|
for e, t, a in world:query(Tag, AnotherTag) do
|
||||||
|
added += 1
|
||||||
|
end
|
||||||
|
expect(added).to.equal(0)
|
||||||
|
end)
|
||||||
|
|
||||||
it("should query correct number of compatible archetypes", function()
|
it("should query correct number of compatible archetypes", function()
|
||||||
local added = 0
|
local added = 0
|
||||||
for _ in world:query(B, C, D, F) do
|
for _ in world:query(B, C, D, F) do
|
||||||
|
@ -107,6 +126,7 @@ return function()
|
||||||
end
|
end
|
||||||
expect(added).to.equal(amountOfCombination)
|
expect(added).to.equal(amountOfCombination)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("should not query poisoned players", function()
|
it("should not query poisoned players", function()
|
||||||
local Player = world:entity()
|
local Player = world:entity()
|
||||||
local Health = world:entity()
|
local Health = world:entity()
|
||||||
|
|
Loading…
Reference in a new issue