Skip to content

Commit

Permalink
add: map::set_revealed ut
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkaptur committed Jul 29, 2018
1 parent 9e68d7e commit d3417cb
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions test/map_test.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
#include <catch.hpp>
#include <engine/map.h>

TEST_CASE("proper_width_and_height", "[map_test]") {
constexpr auto width = 4;
constexpr auto height = 6;
namespace {
constexpr auto width = 4;
constexpr auto height = 6;
}

TEST_CASE("proper_width_and_height", "map_test") {
minesweeper::map mymap(width, height);
REQUIRE(mymap.get_width() == width);
REQUIRE(mymap.get_height() == height);
}

TEST_CASE("hidden_map_on_new_map", "[map_test]") {
constexpr auto width = 4;
constexpr auto height = 6;

TEST_CASE("hidden_map_by_default", "map_test") {
minesweeper::map mymap(width, height);
const auto& internal_map = mymap.get_internal_map();
for (const auto& row : internal_map) {
Expand All @@ -22,3 +21,10 @@ TEST_CASE("hidden_map_on_new_map", "[map_test]") {
}
}
}

TEST_CASE("reveal_proper_map_element", "map_test") {
constexpr auto x = 2, y = 3;
minesweeper::map mymap(width, height);
mymap.set_revealed(x, y);
REQUIRE(mymap.get_internal_map().at(x).at(y).is_revealed);
}

0 comments on commit d3417cb

Please sign in to comment.