Add tests for and fix is_valid_position

master
Tait Hoyem 5 years ago
parent f80d961dea
commit 0422768eb0

@ -50,5 +50,5 @@ int get_file(int position){
// it indicates that is it off the board.
// ASSUMING position <= 128 but if it was that big that'd be weird.
bool is_valid_position(int position){
return (position & 0x40);
return !(position & 0x40);
}

@ -83,3 +83,9 @@ TEST_CASE("Test that bitwise operators return appropriate values. Move.from", "[
CHECK(get_castle_flag(MOVE_H1_TO_G1_AND_get_castle_flagLE) == 1);
}
TEST_CASE("Test that is_valid_position works properly", "[is_valid_position]"){
CHECK(is_valid_position(0));
CHECK(is_valid_position(63));
CHECK_FALSE(is_valid_position(-1));
CHECK_FALSE(is_valid_position(64));
}

Loading…
Cancel
Save