From 63013dee539b33c682dd46ae4a086b2f75f46f16 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Thu, 5 Jul 2018 22:44:35 +0200 Subject: Add a test to ensure valid C code in the C API All current tests are written in C++. Therefore C++-only code in the C API might not be detected by the tests. This patch adds a minimal test written in C that only includes the C API header. This should make sure that the C API code is valid. The new test is called `test_minimal.c` and is added to the CMake COMPILE_OFFLINE_TESTS option. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 06ab448..43d15df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,6 +178,10 @@ IF(COMPILE_OFFLINE_TESTS) #run with 'make test' or 'ctest' include (CTest) add_test (runs test_offline) + + add_executable(test_minimal unittest/test_minimal.c) + target_link_libraries(test_minimal ${EXTRA_LIBS} nitrokey) + add_test(minimal test_minimal) ENDIF() IF (COMPILE_TESTS) -- cgit v1.2.1