From eb4995ee413b25652b770002c438e00fa4ffdf67 Mon Sep 17 00:00:00 2001 From: TriantaTV Date: Sun, 10 Sep 2023 16:29:34 -0500 Subject: [PATCH] Setting up testing --- CMakeLists.txt | 4 ++++ test/CMakeLists.txt | 9 +++++++++ test/testing.cpp | 23 +++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 test/CMakeLists.txt create mode 100644 test/testing.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index e9dd0d7..45d418c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,3 +12,7 @@ set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) include_directories(${search-algorithms_SOURCE_DIR}/src) add_subdirectory(src) + +if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + add_subdirectory(test) +endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..4786b92 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,9 @@ +find_package(unity REQUIRED) +include_directories("${CMAKE_CURRENT_SOURCE_DIR}") +add_executable(testing + ./testing.cpp + ../src/main.cpp + ../src/algorithm.cpp +) +set_target_properties(testing PROPERTIES LINKER_LANGUAGE CXX) +target_link_libraries(testing unity) diff --git a/test/testing.cpp b/test/testing.cpp new file mode 100644 index 0000000..f0e94c0 --- /dev/null +++ b/test/testing.cpp @@ -0,0 +1,23 @@ +#include +#include +#include +#include "algorithm.hpp" + +// Function is defined here for testing + +void setUp(void) +{ + ; +} + +void tearDown(void) +{ + ; +} + +int main(void) +{ + UNITY_BEGIN(); + return UNITY_END(); +} +