started idea for testing
parent
3b4a56bd89
commit
c3fc6e6701
|
@ -0,0 +1,3 @@
|
|||
[submodule "vendor/unity"]
|
||||
path = vendor/unity
|
||||
url = https://github.com/ThrowTheSwitch/Unity
|
|
@ -5,7 +5,8 @@ set(CMAKE_C_STANDARD 17)
|
|||
|
||||
find_package(LibArchive REQUIRED)
|
||||
|
||||
include_directories(include)
|
||||
add_subdirectory(vendor/unity)
|
||||
include_directories(include vendor/unity/src)
|
||||
|
||||
file(GLOB CIETER_SRCS src/cieter/**.c)
|
||||
|
||||
|
@ -14,6 +15,12 @@ if(CMAKE_BUILD_TYPE STREQUAL Release)
|
|||
endif()
|
||||
|
||||
add_library(cieter SHARED ${CIETER_SRCS})
|
||||
target_link_libraries(cieter LibArchive::LibArchive)
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^Test")
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
option(BUILD_CIETERD "Build cieterd binary" ON)
|
||||
|
||||
|
@ -21,5 +28,5 @@ if (BUILD_CIETERD)
|
|||
file(GLOB CIETERD_SRCS src/cieterd/**.c)
|
||||
|
||||
add_executable(cieterd ${CIETERD_SRCS})
|
||||
target_link_libraries(cieterd cieter LibArchive::LibArchive)
|
||||
target_link_libraries(cieterd cieter)
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
file(GLOB TEST_SRCS **.c)
|
||||
|
||||
foreach(TEST_SRC ${TEST_SRCS})
|
||||
get_filename_component(EXEC_NAME ${TEST_SRC} NAME_WLE)
|
||||
add_executable(${EXEC_NAME} ${TEST_SRC})
|
||||
add_test(NAME ${EXEC_NAME} COMMAND ${EXEC_NAME})
|
||||
target_link_libraries(${EXEC_NAME} cieter unity)
|
||||
endforeach()
|
|
@ -0,0 +1,17 @@
|
|||
#include "unity.h"
|
||||
#include "cieter_dynarray.h"
|
||||
|
||||
void setUp(void) {}
|
||||
void tearDown(void) {}
|
||||
|
||||
void test_init() {
|
||||
CieterDynArray *arr = cieter_dynarray_init(2);
|
||||
|
||||
TEST_ASSERT_NOT_NULL(arr);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
UNITY_BEGIN();
|
||||
RUN_TEST(test_init);
|
||||
return UNITY_END();
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 0b92f9b960e4af9afc2b2d0918ce602111682e54
|
Loading…
Reference in New Issue