diff options
Diffstat (limited to 'source/test')
-rw-r--r-- | source/test/programs/CMakeLists.txt | 10 | ||||
-rw-r--r-- | source/test/programs/signals.c | 18 | ||||
-rw-r--r-- | source/test/programs/too_many_tests.c | 2 | ||||
-rw-r--r-- | source/test/unittests/test_duration.test.c | 2 |
4 files changed, 31 insertions, 1 deletions
diff --git a/source/test/programs/CMakeLists.txt b/source/test/programs/CMakeLists.txt index 24932bd..9c58599 100644 --- a/source/test/programs/CMakeLists.txt +++ b/source/test/programs/CMakeLists.txt @@ -28,4 +28,14 @@ if(KIT_ENABLE_TESTING) cpp_example_test PROPERTIES TIMEOUT "30") + + add_executable(signals signals.c) + target_link_libraries(signals ${KIT_TEST_LIBRARY}) + add_test( + NAME signals_test + COMMAND signals) + set_tests_properties( + signals_test + PROPERTIES + TIMEOUT "30") endif() diff --git a/source/test/programs/signals.c b/source/test/programs/signals.c new file mode 100644 index 0000000..935623a --- /dev/null +++ b/source/test/programs/signals.c @@ -0,0 +1,18 @@ +#include "../../kit_test/test.h" + +#include <stdlib.h> + +TEST("abort") { + abort(); +} + +TEST("invalid access") { + *(volatile int *) NULL = 42; +} + +int main(int argc, char **argv) { + if (run_tests(argc, argv) != 1) + return 1; + + return 0; +} diff --git a/source/test/programs/too_many_tests.c b/source/test/programs/too_many_tests.c index 9893e84..bc7b543 100644 --- a/source/test/programs/too_many_tests.c +++ b/source/test/programs/too_many_tests.c @@ -4,7 +4,7 @@ void bar(int index, kit_test_report_fn report) { } int main(int argc, char **argv) { for (int i = 0; i <= KIT_TESTS_SIZE_LIMIT; i++) - test_register("foo", bar); + test_register("foo", __FILE__, bar); if (run_tests(argc, argv) != 1) return 1; diff --git a/source/test/unittests/test_duration.test.c b/source/test/unittests/test_duration.test.c index 5d9e578..0912d9f 100644 --- a/source/test/unittests/test_duration.test.c +++ b/source/test/unittests/test_duration.test.c @@ -1,6 +1,8 @@ #define KIT_TEST_FILE test_duration #include "../../kit_test/test.h" +#include <stdlib.h> + #if defined(_WIN32) && !defined(__CYGWIN__) __declspec(dllimport) void __stdcall Sleep(unsigned long timeout); static void kit_sleep(int ms) { |