📦More tests for archetypes📦
This commit is contained in:
parent
bcd5a8135d
commit
72f635400a
1 changed files with 34 additions and 4 deletions
|
@ -473,12 +473,40 @@ TEST_CASE("Archetype signature management")
|
||||||
// Initial state: empty archetype
|
// Initial state: empty archetype
|
||||||
REQUIRE(w.archetype_count() == 0);
|
REQUIRE(w.archetype_count() == 0);
|
||||||
|
|
||||||
auto e = w.make_entity();
|
auto e0 = w.make_entity();
|
||||||
REQUIRE(w.archetype_count() == 1);
|
REQUIRE(w.archetype_count() == 1); //<>
|
||||||
|
|
||||||
// Add first component
|
// Add first component
|
||||||
w.set<A>(e);
|
w.set<A>(e0);
|
||||||
REQUIRE(w.archetype_count() == 1);
|
REQUIRE(w.archetype_count() == 1); //<A>
|
||||||
|
|
||||||
|
w.set<B>(e0);
|
||||||
|
REQUIRE(w.archetype_count() == 1); //<A, B>
|
||||||
|
|
||||||
|
w.set<C>(e0);
|
||||||
|
REQUIRE(w.archetype_count() == 1); //<A, B, C>
|
||||||
|
|
||||||
|
w.remove<A, B>(e0);
|
||||||
|
REQUIRE(w.archetype_count() == 1); //<C>
|
||||||
|
|
||||||
|
auto e1 = w.make_entity();
|
||||||
|
w.set<A, B>(e1);
|
||||||
|
REQUIRE(w.archetype_count() == 2); //<C>, <A, B>
|
||||||
|
|
||||||
|
w.remove<C>(e0);
|
||||||
|
REQUIRE(w.archetype_count() == 2); //<>, <A, B>
|
||||||
|
|
||||||
|
w.set<A>(e0);
|
||||||
|
REQUIRE(w.archetype_count() == 2); //<A>, <A, B>
|
||||||
|
|
||||||
|
w.set<B>(e0);
|
||||||
|
REQUIRE(w.archetype_count() == 1); //<A, B>
|
||||||
|
|
||||||
|
w.destroy_entity(e0);
|
||||||
|
REQUIRE(w.archetype_count() == 1); //<A, B>
|
||||||
|
|
||||||
|
w.destroy_entity(e1);
|
||||||
|
REQUIRE(w.archetype_count() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Component distribution across archetypes")
|
TEST_CASE("Component distribution across archetypes")
|
||||||
|
@ -499,11 +527,13 @@ TEST_CASE("Component distribution across archetypes")
|
||||||
auto e = w.make_entity();
|
auto e = w.make_entity();
|
||||||
w.set<A>(e);
|
w.set<A>(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 3; ++i)
|
for(int i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
auto e = w.make_entity();
|
auto e = w.make_entity();
|
||||||
w.set<A, B>(e);
|
w.set<A, B>(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 2; ++i)
|
for(int i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
auto e = w.make_entity();
|
auto e = w.make_entity();
|
||||||
|
|
Loading…
Reference in a new issue