summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--source/kit_test/test.h4
-rw-r--r--source/test/programs/CMakeLists.txt10
-rw-r--r--source/test/programs/cpp.cpp13
4 files changed, 26 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97d2d10..8496ab4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,7 @@ project(
${KIT_PROJECT}
VERSION 0.1.1
DESCRIPTION "A collection of C libraries"
- LANGUAGES C)
+ LANGUAGES C CXX)
if(KIT_ENABLE_LIBRARY OR KIT_ENABLE_TESTING)
add_library(${KIT_LIBRARY} STATIC)
diff --git a/source/kit_test/test.h b/source/kit_test/test.h
index f8e79dc..176d957 100644
--- a/source/kit_test/test.h
+++ b/source/kit_test/test.h
@@ -45,10 +45,10 @@ extern kit_tests_list_t kit_tests_list;
#ifdef __cplusplus
# define KIT_TEST_ON_START_(f) \
- static void f(void); \
+ static void f(void) noexcept; \
static int KIT_TEST_CONCAT3_(_kit_test_init_, __LINE__, \
f) = (f(), 0); \
- static void f(void)
+ static void f(void) noexcept
#else
# ifdef _MSC_VER
# ifdef __cplusplus
diff --git a/source/test/programs/CMakeLists.txt b/source/test/programs/CMakeLists.txt
index 4fd3660..641aa16 100644
--- a/source/test/programs/CMakeLists.txt
+++ b/source/test/programs/CMakeLists.txt
@@ -18,4 +18,14 @@ if(KIT_ENABLE_TESTING)
too_many_assertions_test
PROPERTIES
TIMEOUT "30")
+
+ add_executable(cpp cpp.cpp)
+ target_link_libraries(cpp ${KIT_TEST_LIBRARY})
+ add_test(
+ NAME cpp_test
+ COMMAND cpp)
+ set_tests_properties(
+ cpp_test
+ PROPERTIES
+ TIMEOUT "30")
endif()
diff --git a/source/test/programs/cpp.cpp b/source/test/programs/cpp.cpp
new file mode 100644
index 0000000..ca0b4c7
--- /dev/null
+++ b/source/test/programs/cpp.cpp
@@ -0,0 +1,13 @@
+#include "../../kit_test/test.h"
+
+TEST("foo") {
+ REQUIRE(20 + 22 == 42);
+}
+
+TEST("bar") {
+ REQUIRE(true);
+}
+
+auto main(int argc, char **argv) -> int {
+ return run_tests(argc, argv);
+}