Test suite now accurately runs the GameEngine FSM for multiple rounds.
This commit is contained in:
parent
07a212d9d7
commit
07553400f5
6 changed files with 50 additions and 18 deletions
|
@ -4,13 +4,38 @@
|
|||
|
||||
using namespace fmt;
|
||||
|
||||
TEST_CASE("game engine can start and take hit", "[game_engine]") {
|
||||
TEST_CASE("game engine death cycle", "[game_engine]") {
|
||||
// test fails on purpose right now
|
||||
GameEngine game{4};
|
||||
REQUIRE(!game.is_dead() == true);
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
game.event(GameEvent::BUILD_START);
|
||||
REQUIRE(game.hit_points == 4);
|
||||
// confirm streaks, hit_taken, rounds are maintained
|
||||
REQUIRE(game.streak == 0);
|
||||
REQUIRE(game.rounds == i);
|
||||
|
||||
game.event(GameEvent::HIT, "error");
|
||||
REQUIRE(game.hit_points == 0);
|
||||
|
||||
// in dead state these are ignored
|
||||
game.event(GameEvent::HIT);
|
||||
game.event(GameEvent::HIT);
|
||||
game.event(GameEvent::HIT);
|
||||
game.event(GameEvent::HIT);
|
||||
REQUIRE(game.hit_points == 0);
|
||||
REQUIRE(game.is_dead() == true);
|
||||
|
||||
// this is ignored too for now
|
||||
game.event(GameEvent::BUILD_FAILED);
|
||||
REQUIRE(game.hits_taken == 5);
|
||||
REQUIRE(game.hit_points == 0);
|
||||
REQUIRE(game.is_dead() == true);
|
||||
game.event(GameEvent::BUILD_DONE);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("", "[game_engine]") {
|
||||
TEST_CASE("game can do success build", "[game_engine]") {
|
||||
// test fails on purpose right now
|
||||
GameEngine game{100};
|
||||
REQUIRE(game.is_dead() == false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue