diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e1573d44d33823edd057328f9ea080de8d47d544..21ba01a73f832740577e6862c402022c56cb57ba 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2,12 +2,15 @@ include_directories("${CATCH_INCLUDE_PATH}") set(EXECUTABLE_OUTPUT_PATH ${PASTIS_BINARY_DIR}) add_executable (unit_tests - main.cpp - example.cpp - example2.cpp) + test_main.cpp + test_RevisionInfo.cpp + test_TinyVector.cpp) target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}) -target_link_libraries (unit_tests Catch) +target_link_libraries ( + unit_tests + PastisUtils + Catch) enable_testing() diff --git a/tests/example.cpp b/tests/example.cpp deleted file mode 100644 index 0cbc903b5551a10d3ad3e76bd09972acf382a0ce..0000000000000000000000000000000000000000 --- a/tests/example.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include <catch.hpp> - -TEST_CASE("Test1", "[unit]") { - int a = 1; - int b = 2; - REQUIRE(a == b); -} - -TEST_CASE("Test2") { - int a = 2; - int b = 2; - REQUIRE(a == b); -} - -TEST_CASE("Test3", "[a][b][c]") { - int a = 1; - int b = 2; - REQUIRE(a != b); -} diff --git a/tests/example2.cpp b/tests/example2.cpp deleted file mode 100644 index 076fa584044eda8a07bfe603f55e612ee603dc27..0000000000000000000000000000000000000000 --- a/tests/example2.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include <catch.hpp> - -TEST_CASE("Test5", "[unit]") { - int a = 1; - int b = 2; - REQUIRE(a+1 == b); -} - -TEST_CASE("Test6", "[a]") { - int a = 2; - int b = 2; - REQUIRE(a == b); -} - -TEST_CASE("Test7", "[a][b][c]") { - int a = 1; - int b = 2; - REQUIRE(a != b); -} diff --git a/tests/main.cpp b/tests/main.cpp deleted file mode 100644 index 7253fe66f48946f0165430bfa61ce733b8c5a7d6..0000000000000000000000000000000000000000 --- a/tests/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#define CATCH_CONFIG_MAIN -#include <catch.hpp> -// #define CATCH_CONFIG_RUNNER -// #include <catch.hpp> - -// int main(int argc, char* argv[]) { -// auto result = Catch::Session().run(argc, argv); -// return (result < 0xff ? result : 0xff); -// } diff --git a/tests/test_RevisionInfo.cpp b/tests/test_RevisionInfo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9359c8cb33fae4ba34385166e50395bda75542d9 --- /dev/null +++ b/tests/test_RevisionInfo.cpp @@ -0,0 +1,7 @@ +#include <catch.hpp> + +#include <RevisionInfo.hpp> + +TEST_CASE("RevisionInfo", "[utils]") { + REQUIRE(RevisionInfo::hasGitInfo() == true); +} diff --git a/tests/test_TinyVector.cpp b/tests/test_TinyVector.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5e29a8e5da409030bdb478fb278ec64f63b02d20 --- /dev/null +++ b/tests/test_TinyVector.cpp @@ -0,0 +1,8 @@ +#include <catch.hpp> + +#include <TinyVector.hpp> + +TEST_CASE("TinyVector", "[algebra]") { + TinyVector<3,int> v(1,2,3); + REQUIRE(((v[0] == 1) and (v[1] == 2) and (v[2] == 3))); +} diff --git a/tests/test_main.cpp b/tests/test_main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b3143fbb1788b7daef8a6cc20d8a0e9bafb308a5 --- /dev/null +++ b/tests/test_main.cpp @@ -0,0 +1,2 @@ +#define CATCH_CONFIG_MAIN +#include <catch.hpp>