Typo
This commit is contained in:
parent
3d81378824
commit
3ad8fc6d21
1 changed files with 23 additions and 23 deletions
|
@ -37,7 +37,7 @@ TEST_CASE("Entity #0 should be reserved and never used", "[test]")
|
||||||
REQUIRE_FALSE(w.is_alive(0));
|
REQUIRE_FALSE(w.is_alive(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ChoosenOne
|
struct ChosenOne
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ TEST_CASE("Entity shouldn't have a component that wasn't attached to it",
|
||||||
|
|
||||||
auto e = w.make_entity();
|
auto e = w.make_entity();
|
||||||
|
|
||||||
REQUIRE_FALSE(w.has<ChoosenOne>(e));
|
REQUIRE_FALSE(w.has<ChosenOne>(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Attempt of getting non-owned component should throw", "[test]")
|
TEST_CASE("Attempt of getting non-owned component should throw", "[test]")
|
||||||
|
@ -57,7 +57,7 @@ TEST_CASE("Attempt of getting non-owned component should throw", "[test]")
|
||||||
|
|
||||||
auto e = w.make_entity();
|
auto e = w.make_entity();
|
||||||
|
|
||||||
REQUIRE_THROWS(w.get<ChoosenOne>(e));
|
REQUIRE_THROWS(w.get<ChosenOne>(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Attach a simple component to an entity and verify it is correctly "
|
TEST_CASE("Attach a simple component to an entity and verify it is correctly "
|
||||||
|
@ -68,12 +68,12 @@ TEST_CASE("Attach a simple component to an entity and verify it is correctly "
|
||||||
|
|
||||||
auto e1 = w.make_entity();
|
auto e1 = w.make_entity();
|
||||||
|
|
||||||
w.set(e1, ChoosenOne{});
|
w.set(e1, ChosenOne{});
|
||||||
REQUIRE(w.has<ChoosenOne>(e1));
|
REQUIRE(w.has<ChosenOne>(e1));
|
||||||
|
|
||||||
auto e2 = w.make_entity();
|
auto e2 = w.make_entity();
|
||||||
w.set(e2, ChoosenOne{});
|
w.set(e2, ChosenOne{});
|
||||||
REQUIRE(w.has<ChoosenOne>(e2));
|
REQUIRE(w.has<ChosenOne>(e2));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Comp
|
struct Comp
|
||||||
|
@ -111,21 +111,21 @@ TEST_CASE(
|
||||||
world w;
|
world w;
|
||||||
|
|
||||||
auto e = w.make_entity();
|
auto e = w.make_entity();
|
||||||
w.set(e, ChoosenOne{});
|
w.set(e, ChosenOne{});
|
||||||
REQUIRE_NOTHROW(w.remove<ChoosenOne>(e));
|
REQUIRE_NOTHROW(w.remove<ChosenOne>(e));
|
||||||
|
|
||||||
REQUIRE_FALSE(w.has<ChoosenOne>(e));
|
REQUIRE_FALSE(w.has<ChosenOne>(e));
|
||||||
|
|
||||||
w.set(e, ChoosenOne{});
|
w.set(e, ChosenOne{});
|
||||||
REQUIRE_NOTHROW(w.remove<ChoosenOne>(e));
|
REQUIRE_NOTHROW(w.remove<ChosenOne>(e));
|
||||||
REQUIRE_FALSE(w.has<ChoosenOne>(e));
|
REQUIRE_FALSE(w.has<ChosenOne>(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Addresses of removed components should be reused", "[test]")
|
TEST_CASE("Addresses of removed components should be reused", "[test]")
|
||||||
{
|
{
|
||||||
world w;
|
world w;
|
||||||
std::vector<entity_id> entities;
|
std::vector<entity_id> entities;
|
||||||
std::vector<ChoosenOne*> addr;
|
std::vector<ChosenOne*> addr;
|
||||||
|
|
||||||
const int N = 4;
|
const int N = 4;
|
||||||
|
|
||||||
|
@ -134,14 +134,14 @@ TEST_CASE("Addresses of removed components should be reused", "[test]")
|
||||||
for(int j = 0; j < N; ++j)
|
for(int j = 0; j < N; ++j)
|
||||||
{
|
{
|
||||||
entities.emplace_back(w.make_entity());
|
entities.emplace_back(w.make_entity());
|
||||||
w.set<ChoosenOne>(entities.back());
|
w.set<ChosenOne>(entities.back());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(addr.empty())
|
if(addr.empty())
|
||||||
{
|
{
|
||||||
for(int j = 0; j < N; ++j)
|
for(int j = 0; j < N; ++j)
|
||||||
{
|
{
|
||||||
addr.emplace_back(&w.get<ChoosenOne>(entities[j]));
|
addr.emplace_back(&w.get<ChosenOne>(entities[j]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -153,13 +153,13 @@ TEST_CASE("Addresses of removed components should be reused", "[test]")
|
||||||
|
|
||||||
for(int j = 0; j < N; ++j)
|
for(int j = 0; j < N; ++j)
|
||||||
{
|
{
|
||||||
REQUIRE(&w.get<ChoosenOne>(entities[j]) == addr[j]);
|
REQUIRE(&w.get<ChosenOne>(entities[j]) == addr[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto e: entities)
|
for(auto e: entities)
|
||||||
{
|
{
|
||||||
w.remove<ChoosenOne>(e);
|
w.remove<ChosenOne>(e);
|
||||||
}
|
}
|
||||||
entities.clear();
|
entities.clear();
|
||||||
}
|
}
|
||||||
|
@ -172,14 +172,14 @@ TEST_CASE("Attach multiple components to an entity and verify all are "
|
||||||
world w;
|
world w;
|
||||||
|
|
||||||
auto e = w.make_entity();
|
auto e = w.make_entity();
|
||||||
w.set(e, ChoosenOne{}, Comp{});
|
w.set(e, ChosenOne{}, Comp{});
|
||||||
|
|
||||||
REQUIRE(w.has<ChoosenOne, Comp>(e));
|
REQUIRE(w.has<ChosenOne, Comp>(e));
|
||||||
|
|
||||||
w.remove<ChoosenOne, Comp>(e);
|
w.remove<ChosenOne, Comp>(e);
|
||||||
|
|
||||||
REQUIRE_FALSE(w.has<ChoosenOne, Comp>(e));
|
REQUIRE_FALSE(w.has<ChosenOne, Comp>(e));
|
||||||
REQUIRE_FALSE(w.has<ChoosenOne>(e));
|
REQUIRE_FALSE(w.has<ChosenOne>(e));
|
||||||
REQUIRE_FALSE(w.has<Comp>(e));
|
REQUIRE_FALSE(w.has<Comp>(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue