test: Host-Testumgebung mit Unity, SHA256 und CRC

This commit is contained in:
Michael Sauer
2026-09-11 12:23:04 +02:00
parent 23df6b9d29
commit 4e7ff78fc6
8 changed files with 304 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.20)
project(ninlight_host_tests C)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
include(FetchContent)
FetchContent_Declare(unity
GIT_REPOSITORY https://github.com/ThrowTheSwitch/Unity.git
GIT_TAG v2.6.0)
FetchContent_MakeAvailable(unity)
enable_testing()
set(NL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../src)
function(nl_test name)
add_executable(${name} ${ARGN})
target_include_directories(${name} PRIVATE ${NL_SRC} ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_options(${name} PRIVATE -Wall -Wextra -Werror)
target_compile_definitions(${name} PRIVATE NINLIGHT_HOST_TEST=1)
target_link_libraries(${name} PRIVATE unity m)
add_test(NAME ${name} COMMAND ${name})
endfunction()
nl_test(test_sha256 test_sha256.c ${NL_SRC}/util/nl_sha256.c)
nl_test(test_crc test_crc.c ${NL_SRC}/util/nl_crc.c)