diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5e66a6..126f157 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,9 +31,6 @@ jobs: if: always() run: cmake -DFIX=YES -P cmake/spell.cmake - - name: Download utest.h - run: | - curl -o ./test/source/utest.h https://raw.githubusercontent.com/sheredom/utest.h/master/utest.h coverage: diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2ce6001..c88fd65 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -11,6 +11,16 @@ if(PROJECT_IS_TOP_LEVEL) enable_testing() endif() +# ---- Download utest.h ---- + +set(UTEST_HEADER_URL "https://raw.githubusercontent.com/sheredom/utest.h/master/utest.h") +set(UTEST_HEADER_PATH "${CMAKE_BINARY_DIR}/utest.h") + +if(NOT EXISTS ${UTEST_HEADER_PATH}) + message(STATUS "Downloading utest.h...") + file(DOWNLOAD ${UTEST_HEADER_URL} ${UTEST_HEADER_PATH}) +endif() + # ---- Tests ---- # Create a list of test sources @@ -25,6 +35,9 @@ add_executable(ccontainer_tests ${TEST_SOURCES}) # Ensure the implementation macro is defined target_compile_definitions(ccontainer_tests PRIVATE CC_VECTOR_IMPLEMENTATION) +# Include the downloaded utest.h +target_include_directories(ccontainer_tests PRIVATE ${CMAKE_BINARY_DIR}) + # Link against the ccontainer library target_link_libraries(ccontainer_tests PRIVATE ccontainer::ccontainer) diff --git a/test/source/cc_vector_test.c b/test/source/cc_vector_test.c index d9a1cbb..7491199 100644 --- a/test/source/cc_vector_test.c +++ b/test/source/cc_vector_test.c @@ -1,6 +1,6 @@ #define CC_VECTOR_IMPLEMENTATIONs #include "../../include/ccontainer/cc_vector.h" -#include "utest.h" +#include "../build/utest.h" UTEST(cc_vector, create) { diff --git a/test/source/main_test.c b/test/source/main_test.c index 30dad37..e64f05e 100644 --- a/test/source/main_test.c +++ b/test/source/main_test.c @@ -1,3 +1,3 @@ -#include "utest.h" +#include "../build/utest.h" UTEST_MAIN()