diff --git a/game_rect.cpp b/game_rect.cpp index a398db3d..8c04e59a 100644 --- a/game_rect.cpp +++ b/game_rect.cpp @@ -109,15 +109,6 @@ bool operator==(const game_rect& lhs, const game_rect& rhs) noexcept ; } -game_rect& operator+=(game_rect& rect, const game_coordinat& delta) noexcept -{ - rect = game_rect( - rect.get_tl() + delta, - rect.get_br() + delta - ); - return rect; -} - std::ostream& operator<<(std::ostream& os, const game_rect& r) noexcept { os << "(" << r.get_tl() << "-" << r.get_br() << ")"; diff --git a/piece.cpp b/piece.cpp index a1f75411..d93c1ffa 100644 --- a/piece.cpp +++ b/piece.cpp @@ -268,6 +268,18 @@ void test_piece() const auto p{get_test_white_king()}; assert(get_occupied_square(p) == square("e1")); } + // get_test_white_king + { + const auto p{get_test_white_king()}; + assert(p.get_type() == piece_type::king); + assert(p.get_color() == chess_color::white); + } + // get_test_white_knight + { + const auto p{get_test_white_knight()}; + assert(p.get_type() == piece_type::knight); + assert(p.get_color() == chess_color::white); + } // has_actions { const auto p{get_test_white_king()}; diff --git a/piece_action.cpp b/piece_action.cpp index cc076c27..b69364f8 100644 --- a/piece_action.cpp +++ b/piece_action.cpp @@ -68,7 +68,7 @@ void test_piece_action() const piece_action a(piece_action_type::attack, square("e3")); assert(!to_str(piece_action(a)).empty()); const piece_action b(piece_action_type::move, square("e2"), square("e4")); - assert(!to_str(piece_action(a)).empty()); + assert(!to_str(piece_action(b)).empty()); } // operator<< { diff --git a/test_game.cpp b/test_game.cpp index dfcecc21..c33aa114 100644 --- a/test_game.cpp +++ b/test_game.cpp @@ -67,6 +67,11 @@ void test_game_functions() g.add_action(create_press_left_action()); // cursor to d8 g.tick(); assert(!can_player_select_piece_at_cursor_pos(g, chess_color::white)); + + g.add_action(create_press_left_action()); // cursor to d7 + g.add_action(create_press_left_action()); // cursor to d6 + g.tick(); + assert(!can_player_select_piece_at_cursor_pos(g, chess_color::white)); } // clear_sound_effects {