New TetraIF/unit-test/ directory with one QtTest executable per TetraIF release-scope module, wired into ctest and the DEB pipeline: - coprtcnv_unit_test: central and radio telegram header fields, payload access, length checks, fragmentation/reassembly roundtrip, telegram-id string helpers - logview_unit_test: IntegerCalculator arithmetic, operator priority, parentheses, error codes and variables (compiles the LogView class source directly; the class otherwise lives in the LogView executable) - prtcnv_unit_test: PrtCnvMember state and fragmented-telegram handling (compiles the class source directly because PrtCnvLib is built with hidden visibility) TetraIF/CMakeLists.txt adds the unit-test subdirectory and new_docker_build.sh builds and ctest-runs the three new targets.
51 lines
1.5 KiB
CMake
51 lines
1.5 KiB
CMake
#
|
|
# Unit tests for the TetraIF modules (CoPrtCnv, LogView, PrtCnv).
|
|
# One test executable per module, each registered with ctest.
|
|
#
|
|
# LogView: the module's classes are compiled into the LogView executable,
|
|
# so the test compiles the pure class source (IntegerCalculator) directly
|
|
# instead of linking a library.
|
|
#
|
|
|
|
if (NOT BUILD_TESTING)
|
|
return()
|
|
endif()
|
|
|
|
# --- CoPrtCnv: telegram classes and helpers --------------------------------
|
|
if (TARGET CoPrtCnv)
|
|
ADD_EXECUTABLE(coprtcnv_unit_test coprtcnv_unit_test.cpp)
|
|
TARGET_LINK_LIBRARIES(coprtcnv_unit_test
|
|
CoPrtCnv
|
|
NGLLogger
|
|
Qt6::Core
|
|
Qt6::Test
|
|
)
|
|
ADD_TEST(NAME coprtcnv_unit_test COMMAND $<TARGET_FILE:coprtcnv_unit_test>)
|
|
endif()
|
|
|
|
# --- LogView: IntegerCalculator --------------------------------------------
|
|
ADD_EXECUTABLE(logview_unit_test
|
|
logview_unit_test.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../LogView/IntegerCalculator.cpp)
|
|
TARGET_LINK_LIBRARIES(logview_unit_test
|
|
Qt6::Core
|
|
Qt6::Test
|
|
)
|
|
ADD_TEST(NAME logview_unit_test COMMAND $<TARGET_FILE:logview_unit_test>)
|
|
|
|
# --- PrtCnv: PrtCnvMember (fragmented telegram handling) --------------------
|
|
# PrtCnvLib is built with hidden visibility, so the test compiles the class
|
|
# source directly instead of linking the library.
|
|
if (TARGET CoPrtCnv)
|
|
ADD_EXECUTABLE(prtcnv_unit_test
|
|
prtcnv_unit_test.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../PrtCnv/PrtCnvMember.cpp)
|
|
TARGET_LINK_LIBRARIES(prtcnv_unit_test
|
|
CoPrtCnv
|
|
NGLLogger
|
|
Qt6::Core
|
|
Qt6::Test
|
|
)
|
|
ADD_TEST(NAME prtcnv_unit_test COMMAND $<TARGET_FILE:prtcnv_unit_test>)
|
|
endif()
|