GameEngine is now a state machine so I can push its design further and keep it solid.

This commit is contained in:
Zed A. Shaw 2024-09-12 00:34:41 -04:00
parent 1c89afaee2
commit 9e6c05eccd
5 changed files with 56 additions and 56 deletions

View file

@ -7,32 +7,11 @@ using namespace fmt;
TEST_CASE("game engine can start and take hit", "[game_engine]") {
// test fails on purpose right now
GameEngine game{4};
std::string err{"error"};
game.start_round();
game.hit(err);
game.end_round();
REQUIRE(game.is_dead() == true);
REQUIRE(!game.is_dead() == true);
}
TEST_CASE("", "[game_engine]") {
// test fails on purpose right now
GameEngine game{100};
std::string err{"error"};
game.start_round();
game.hit(err);
game.end_round();
REQUIRE(game.hit_points < 100);
REQUIRE(game.rounds == 1);
REQUIRE(game.streak == 0);
REQUIRE(game.is_dead() == false);
game.start_round();
game.end_round();
REQUIRE(game.hit_points == 100);
REQUIRE(game.rounds == 2);
REQUIRE(game.streak == 1);
REQUIRE(game.is_dead() == false);
}