Adds unit test for randomness.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
2b1a1792bf
commit
cd8a29e8fd
|
@ -35,15 +35,23 @@ TEST_CASE("Clone battle, test basic functionality") {
|
||||||
TEST_CASE("Clone battle, test history history holder") {
|
TEST_CASE("Clone battle, test history history holder") {
|
||||||
auto lib = TestLibrary::Get();
|
auto lib = TestLibrary::Get();
|
||||||
auto battle = Battle(lib, {});
|
auto battle = Battle(lib, {});
|
||||||
auto side = BattleSide(0, &battle, 1);
|
|
||||||
auto c = CreateCreature(TestLibrary::Get(), "testSpecies1"_cnc, 5).Create();
|
|
||||||
side.SetCreature(c, 0);
|
|
||||||
|
|
||||||
auto clone = battle.Clone();
|
auto clone = battle.Clone();
|
||||||
|
|
||||||
clone->RegisterHistoryElement<AttackUseHistory>(nullptr);
|
clone->RegisterHistoryElement<AttackUseHistory>(nullptr);
|
||||||
clone->RegisterHistoryElement<AttackUseHistory>(nullptr);
|
clone->RegisterHistoryElement<AttackUseHistory>(nullptr);
|
||||||
|
|
||||||
delete c;
|
delete clone;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Clone battle, test randomness") {
|
||||||
|
auto lib = TestLibrary::Get();
|
||||||
|
auto battle = Battle(lib, {});
|
||||||
|
auto clone = battle.Clone();
|
||||||
|
|
||||||
|
REQUIRE_EQ(battle.GetRandom()->Get(), clone->GetRandom()->Get());
|
||||||
|
REQUIRE_EQ(battle.GetRandom()->Get(), clone->GetRandom()->Get());
|
||||||
|
REQUIRE_EQ(battle.GetRandom()->Get(), clone->GetRandom()->Get());
|
||||||
|
|
||||||
delete clone;
|
delete clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue