Add tests and improve interface

This commit is contained in:
Loic Guegan 2023-01-19 10:09:07 +01:00
parent 8fd85102ab
commit f3e3ab4911
8 changed files with 21718 additions and 18 deletions

11
tests/CMakeLists.txt Normal file
View file

@ -0,0 +1,11 @@
# Configure catch3
include_directories(./catch3/)
add_library(cmi_catch3 SHARED ./catch3/catch_amalgamated.cpp)
# Add tests
add_executable(cmi_tests cmi_tests.cpp)
target_link_libraries(cmi_tests ChessMoveInterface cmi_catch3)
add_test(CMI_TESTS cmi_tests)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

23
tests/cmi_tests.cpp Normal file
View file

@ -0,0 +1,23 @@
#include "CMI.hpp"
#include <catch_amalgamated.hpp>
using namespace CMI;
#define NEW_MOVE(VAR,SAN) HalfMove *(VAR)=new HalfMove(); (VAR)->SetSAN((SAN));
HalfMove *BuildTree(){
NEW_MOVE(m1,"e4");
NEW_MOVE(m2,"e5");
m1->SetMainline(m2);
return m1;
}
TEST_CASE("CMI Tests", "[valid]") {
HalfMove *m=BuildTree();
CHECK(m->GetNumber()==1);
CHECK(m->GetMainline()->GetNumber()==1);
}