Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ endif()
project(libcdoc VERSION 0.1.5)

macro(SET_ENV NAME DEF)
if(DEFINED ENV{${NAME}})
set(${NAME} $ENV{${NAME}} ${ARGN})
else()
set(${NAME} ${DEF} ${ARGN})
endif()
if(DEFINED ENV{${NAME}})
set(${NAME} $ENV{${NAME}} ${ARGN})
else()
set(${NAME} ${DEF} ${ARGN})
endif()
endmacro()

SET_ENV(BUILD_NUMBER 0)
Expand Down
6 changes: 4 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED YES)

add_executable(unittests libcdoc_boost.cpp)
target_compile_definitions(unittests PRIVATE DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data")
target_link_libraries(unittests cdoc cdoc_priv Boost::unit_test_framework)

add_test(NAME runtest
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/unittests --build_info=YES --logger=HRF,all,stdout -- ${CMAKE_CURRENT_SOURCE_DIR}/data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/unittests --build_info=YES --logger=HRF,all,stdout
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)

add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS unittests)
6 changes: 5 additions & 1 deletion test/libcdoc_boost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#include <Recipient.h>
#include <Utils.h>

#ifndef DATA_DIR
#define DATA_DIR "."
#endif

namespace btools = boost::test_tools;
namespace utf = boost::unit_test;
namespace fs = std::filesystem;
Expand Down Expand Up @@ -50,7 +54,7 @@ class FixtureBase
// Get path to test data, provided via argument to the unit tests application
if (utf::framework::master_test_suite().argc <= 1)
{
testDataPath = ".";
testDataPath = DATA_DIR;
}
else
{
Expand Down