From 53a0755547b1b30c8232a954f75a222918bd6405 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Sun, 2 Feb 2025 14:52:13 +0100 Subject: [PATCH] extracted the assert equals to another file to have mulitple test files --- cpp/tests/fen.cpp | 17 +---------------- cpp/tests/lib.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 16 deletions(-) create mode 100644 cpp/tests/lib.cpp diff --git a/cpp/tests/fen.cpp b/cpp/tests/fen.cpp index 857e917..17f41e3 100644 --- a/cpp/tests/fen.cpp +++ b/cpp/tests/fen.cpp @@ -1,20 +1,5 @@ #include "../board.cpp" - -#define IS_TRUE(x) \ - { \ - if (!(x)) \ - std::cout << __FUNCTION__ << " failed on line " << __LINE__ \ - << std::endl; \ - } - -#define ASSERT_EQUALS(expected, actual) \ - { \ - if (expected != actual) \ - std::cout << "Expected: " << std::endl \ - << '\t' << expected << std::endl \ - << "Got: " << std::endl \ - << '\t' << actual << std::endl; \ - } +#include "lib.cpp" int main() { std::string pos = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR"; diff --git a/cpp/tests/lib.cpp b/cpp/tests/lib.cpp new file mode 100644 index 0000000..82db6bb --- /dev/null +++ b/cpp/tests/lib.cpp @@ -0,0 +1,10 @@ +#pragma once + +#define ASSERT_EQUALS(expected, actual) \ + { \ + if (expected != actual) \ + std::cout << "Expected: " << std::endl \ + << '\t' << expected << std::endl \ + << "Got: " << std::endl \ + << '\t' << actual << std::endl; \ + }