mirror of
https://github.com/bakpakin/tiny-ecs.git
synced 2026-07-21 23:56:50 -06:00
Changed Implementation of Entity Storage.
Remove Use of Sets for Storing Entities in hopes to speed up Iteration. Add some tests.
This commit is contained in:
+21
-3
@@ -110,8 +110,8 @@ describe('tiny-ecs:', function()
|
||||
end)
|
||||
|
||||
it("Create World", function()
|
||||
assert.equals(world.entityCount, 3)
|
||||
assert.equals(world.systemCount, 2)
|
||||
assert.equals(world:getEntityCount(), 3)
|
||||
assert.equals(world:getSystemCount(), 2)
|
||||
end)
|
||||
|
||||
it("Run simple simulation", function()
|
||||
@@ -131,10 +131,11 @@ describe('tiny-ecs:', function()
|
||||
end)
|
||||
|
||||
it("Remove Systems", function()
|
||||
world:remove(oneTimeSystem, moveSystem)
|
||||
world:remove(moveSystem, oneTimeSystem)
|
||||
world:update(1)
|
||||
assert.equals(timePassed, 0)
|
||||
assert.equals(entity1.xform.x, entityTemplate1.xform.x)
|
||||
assert.equals(0, world:getSystemCount())
|
||||
end)
|
||||
|
||||
it("Disable and Enable Systems", function()
|
||||
@@ -160,6 +161,23 @@ describe('tiny-ecs:', function()
|
||||
assert.equals(0, world:getSystemCount())
|
||||
end)
|
||||
|
||||
it("Add Entities Multiple Times", function()
|
||||
world:update(1)
|
||||
world:add(entity1, entity2, entity3)
|
||||
world:update(2)
|
||||
assert.equals(2, world:getSystemCount())
|
||||
assert.equals(3, world:getEntityCount())
|
||||
end)
|
||||
|
||||
it("Remove Entities Multiple Times", function()
|
||||
world:update(1)
|
||||
world:remove(entity1, entity2, entity3)
|
||||
world:update(2)
|
||||
world:remove(entity1, entity2, entity3)
|
||||
world:update(2)
|
||||
assert.equals(2, world:getSystemCount())
|
||||
assert.equals(0, world:getEntityCount())
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user