From dde8996131c4f7cd9167b42f80f25930151f872a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Mon, 18 Oct 2021 13:41:49 +0200 Subject: [PATCH] Ex 15: Add unit tests for isWall(). --- test/testBoard.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/testBoard.cpp b/test/testBoard.cpp index c9c6fb5..8e296a1 100644 --- a/test/testBoard.cpp +++ b/test/testBoard.cpp @@ -65,4 +65,15 @@ TEST_CASE("Teleport", "[board]") { const pacman::GridPosition result = pacman::teleport(portalLeft); REQUIRE(result.x == portalRight.x); } -} \ No newline at end of file +} + +TEST_CASE("Is wall", "[board]") { + REQUIRE(pacman::isWall(pacman::GridPosition{ 0, 0 })); + REQUIRE(pacman::isWall(pacman::GridPosition{ 27, 30 })); + REQUIRE(!pacman::isWall(pacman::GridPosition{ 1, 1 })); + REQUIRE(!pacman::isWall(pacman::GridPosition{ 26, 29 })); + REQUIRE(!pacman::isWall(pacman::GridPosition{ 0, 14 })); + REQUIRE(!pacman::isWall(pacman::GridPosition{ 27, 14 })); + REQUIRE(!pacman::isWall(pacman::GridPosition{ 11, 13 })); + REQUIRE(!pacman::isWall(pacman::GridPosition{ 16, 15 })); +}