Files
cpl_cpp-project/Tests/BitBoardTest.cpp
2022-12-22 12:10:14 +01:00

22 lines
873 B
C++

#include "catch2/catch.hpp"
#include "TestUtils.hpp"
#include "BitBoard.hpp"
#include <set>
#include <iostream>
TEST_CASE("King attacks are correctly generated", "[Board][Fundamental]") {
auto board = BitBoard::fromIndex(G2);
board |= BitBoard::fromIndex(B7);
BitBoard ka = BitBoard::kingAttacks(board);
REQUIRE((ka == (
BitBoard::fromIndex(G1) | BitBoard::fromIndex(G3) | BitBoard::fromIndex(H1) | BitBoard::fromIndex(H2)
| BitBoard::fromIndex(H3) | BitBoard::fromIndex(F1) | BitBoard::fromIndex(F2)
| BitBoard::fromIndex(F3) |
BitBoard::fromIndex(B8) | BitBoard::fromIndex(B6) | BitBoard::fromIndex(A6)
| BitBoard::fromIndex(A7) | BitBoard::fromIndex(A8) | BitBoard::fromIndex(C6)
| BitBoard::fromIndex(C7) | BitBoard::fromIndex(C8))));
}