From c585c1543e33730d0b22eecff795cb920c5f524e Mon Sep 17 00:00:00 2001 From: Tait Hoyem <44244401+TTWNO@users.noreply.github.com> Date: Tue, 23 Apr 2019 17:24:21 +0000 Subject: [PATCH] Check get_to_squares works properly --- src/functions.cpp | 1 + tests/main.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/functions.cpp b/src/functions.cpp index 11266c5..b059e94 100644 --- a/src/functions.cpp +++ b/src/functions.cpp @@ -224,6 +224,7 @@ std::array dumb_move(int move, std::array board) std::unordered_set get_to_squares(std::unordered_set moves){ std::unordered_set to_squares; for (int move : moves){ + std::cout << "SQ: " << get_to_sq(move) << "\n"; to_squares.insert(get_to_sq(move)); } return to_squares; diff --git a/tests/main.cpp b/tests/main.cpp index d759546..f43946b 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -20,6 +20,12 @@ const std::array DUMB_MOVE_1 = { INV, INV, INV, INV, INV, INV, INV, INV, INV, INV }; +TEST_CASE("Test that the get_to_squares works, this is required!", "[get_to_squares]"){ + std::unordered_set to_squares = {Position::H1}; + std::unordered_set moves = {0b11000100000000}; + REQUIRE(get_to_squares(moves) == to_squares); +} + TEST_CASE("Test that an unordered set of positions are returned when looking for a piece type through a board", "[get_pos_of]"){ CHECK(get_poss_of(PieceType::B_PAWN, &DEFAULT_BOARD) == B_PAWNS_SQUARES); }