Skip to content

Commit

Permalink
Add tests for checking if game should continue.
Browse files Browse the repository at this point in the history
  • Loading branch information
przemek83 committed Oct 7, 2024
1 parent a34c670 commit c0a2bb1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions test/GameTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,22 @@ TEST_CASE("Check winning conditions", "[Game]")
FakeDisplay display;
Config::getInstance().setDefaultSleepTimeInSeconds(0);

std::list<Tank> tanks;
Point point{0, 0};
Map map{3};

SECTION("Check no more enemies")
{
std::list<Tank> tanks;
Point point{0, 0};
tanks.emplace_back(TankType::PLAYER_TIER_1, point);
Map map{3};
Game game(tanks, map);
REQUIRE(game.isGameEnding(display));
}

SECTION("Check game continues")
{
tanks.emplace_back(TankType::PLAYER_TIER_1, point);
tanks.emplace_back(TankType::ENEMY_TIER_1, point);
Game game(tanks, map);
REQUIRE(!game.isGameEnding(display));
}
}

0 comments on commit c0a2bb1

Please sign in to comment.