diff --git a/.gitmodules b/.gitmodules index a65741a..b7872dc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "lib/vectorwrapper"] path = lib/vectorwrapper url = https://github.com/KingDuckZ/vectorwrapper.git +[submodule "lib/catch"] + path = lib/catch + url = https://github.com/philsquared/Catch.git diff --git a/CMakeLists.txt b/CMakeLists.txt index de6899d..dfcd429 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(CloonelJump CXX) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/include") include(TargetArch) +include(CTest) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wconversion") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -pedantic -Wconversion -DWITH_DEBUG_VISUALS -O0") @@ -140,6 +141,9 @@ if (RASPBERRY_PI) ) endif(RASPBERRY_PI) +if (BUILD_TESTING) + add_subdirectory(test/unit) +endif() target_compile_features(${PROJECT_NAME} PRIVATE cxx_nullptr PRIVATE cxx_range_for diff --git a/lib/catch b/lib/catch new file mode 160000 index 0000000..30cebd6 --- /dev/null +++ b/lib/catch @@ -0,0 +1 @@ +Subproject commit 30cebd617788f6b399297725f97317f9bc462114 diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt new file mode 100644 index 0000000..e4981c5 --- /dev/null +++ b/test/unit/CMakeLists.txt @@ -0,0 +1,15 @@ +project(clooneltest CXX) + +add_executable(${PROJECT_NAME} + main.cpp +) + +target_include_directories(${PROJECT_NAME} + PRIVATE ${CMAKE_SOURCE_DIR}/lib/catch/single_include +) + +add_test( + NAME CloonelJumpTest + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PROJECT_NAME} +) diff --git a/test/unit/main.cpp b/test/unit/main.cpp new file mode 100644 index 0000000..0c7c351 --- /dev/null +++ b/test/unit/main.cpp @@ -0,0 +1,2 @@ +#define CATCH_CONFIG_MAIN +#include "catch.hpp"