Removed the python version and kept just the c++ one
Some checks failed
pre-release / Pre Release (push) Waiting to run
tagged-release / Tagged Release (push) Has been cancelled

This commit is contained in:
Karma Riuk
2025-02-16 09:36:04 +01:00
parent 0145664567
commit 5cbe57dc55
91 changed files with 29 additions and 1531 deletions

23
tests/fen.cpp Normal file
View File

@ -0,0 +1,23 @@
#include "../src/model/board/board.hpp"
#include "lib.hpp"
int main() {
std::string pos =
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
ASSERT_EQUALS(pos, Board::setup_fen_position(pos).to_fen());
pos = "r1bk3r/p2pBpNp/n4n2/1p1NP2P/6P1/3P4/P1P1K3/q5b1 b Qk - 0 1";
ASSERT_EQUALS(pos, Board::setup_fen_position(pos).to_fen());
pos = "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1";
ASSERT_EQUALS(pos, Board::setup_fen_position(pos).to_fen());
pos = "4k2r/6r1/8/8/8/8/3R4/R3K3 w Qk - 0 1";
ASSERT_EQUALS(pos, Board::setup_fen_position(pos).to_fen());
pos = "8/8/8/4p1K1/2k1P3/8/8/8 b - - 0 1";
ASSERT_EQUALS(pos, Board::setup_fen_position(pos).to_fen());
pos = "8/5k2/3p4/1p1Pp2p/pP2Pp1P/P4P1K/8/8 b - - 99 50";
ASSERT_EQUALS(pos, Board::setup_fen_position(pos).to_fen());
}

16
tests/lib.hpp Normal file
View File

@ -0,0 +1,16 @@
#pragma once
#include <iostream>
#define ASSERT_EQUALS(x, y) \
{ \
auto expected = x; \
auto actual = y; \
if (expected != actual) { \
std::cerr << "Expected: " << std::endl \
<< '\t' << expected << std::endl \
<< "Got: " << std::endl \
<< '\t' << actual << std::endl; \
exit(1); \
} \
}

20
tests/positions.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "../src/model/utils/coords.hpp"
#include "lib.hpp"
int main() {
ASSERT_EQUALS(Coords(0, 0).to_algebraic(), "a1");
ASSERT_EQUALS(Coords(1, 0).to_algebraic(), "b1");
ASSERT_EQUALS(Coords(2, 1).to_algebraic(), "c2");
ASSERT_EQUALS(Coords(4, 2).to_algebraic(), "e3");
ASSERT_EQUALS(Coords(7, 7).to_algebraic(), "h8");
ASSERT_EQUALS(Coords::from_algebraic("a1"), Coords(0, 0));
ASSERT_EQUALS(Coords::from_algebraic("b1"), Coords(1, 0));
ASSERT_EQUALS(Coords::from_algebraic("c2"), Coords(2, 1));
ASSERT_EQUALS(Coords::from_algebraic("e3"), Coords(4, 2));
ASSERT_EQUALS(Coords::from_algebraic("h8"), Coords(7, 7));
}