add all old corelib tests

This commit is contained in:
2024-10-24 21:33:19 +01:00
parent 44fb8593a5
commit f0db9d67cb
9 changed files with 241 additions and 7 deletions

View File

@@ -6,17 +6,31 @@ set(b_modules core object term cmd)
set(b_system_name ${CMAKE_SYSTEM_NAME})
string(TOLOWER ${b_system_name} b_system_name)
message(STATUS "System name: ${b_system_name}")
foreach (module ${b_modules})
add_subdirectory(${module})
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${module}-test)
message(STATUS "Building unit tests for module ${module}")
add_executable(blue-${module}-test
${module}-test/${module}-test.c
misc/AllTests.c
misc/CuTest.c
misc/CuTest.h)
target_link_libraries(blue-${module}-test blue-${module})
target_include_directories(blue-${module}-test PRIVATE misc/)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${module}-test/${module}-units.c)
add_executable(blue-${module}-units
${module}-test/${module}-units.c
misc/AllTests.c
misc/CuTest.c
misc/CuTest.h)
target_link_libraries(blue-${module}-units blue-${module})
target_include_directories(blue-${module}-units PRIVATE misc/)
endif ()
file(GLOB test_sources ${module}-test/*.c)
list(REMOVE_ITEM test_sources "${CMAKE_CURRENT_SOURCE_DIR}/${module}-test/${module}-units.c")
foreach (test_file ${test_sources})
get_filename_component(test_name ${test_file} NAME_WE)
add_executable(blue-${module}-${test_name} ${test_file})
target_link_libraries(blue-${module}-${test_name} blue-${module})
endforeach (test_file)
endif ()
endforeach (module)