Adds unit test for randomness.
continuous-integration/drone/push Build is passing Details

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
Deukhoofd 2021-04-11 16:03:08 +02:00
parent 2b1a1792bf
commit cd8a29e8fd
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 13 additions and 5 deletions

View File

@ -35,15 +35,23 @@ TEST_CASE("Clone battle, test basic functionality") {
TEST_CASE("Clone battle, test history history holder") {
auto lib = TestLibrary::Get();
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();
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;
}