]> gitweb.hhaalo.de Git - mv_none_space.git/commitdiff
add sanity check for testing framework cmocka
authorBastian Dehn <hhaalo@arcor.de>
Tue, 16 Jul 2024 09:21:22 +0000 (11:21 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 16 Jul 2024 09:21:22 +0000 (11:21 +0200)
src/rename.c [new file with mode: 0644]
src/rename.h [new file with mode: 0644]
tests/CMakeLists.txt
tests/rename_tests.c [new file with mode: 0644]

diff --git a/src/rename.c b/src/rename.c
new file mode 100644 (file)
index 0000000..424074f
--- /dev/null
@@ -0,0 +1 @@
+#include "rename.h"
\ No newline at end of file
diff --git a/src/rename.h b/src/rename.h
new file mode 100644 (file)
index 0000000..47ab8fb
--- /dev/null
@@ -0,0 +1,4 @@
+#ifndef RENAME_H
+#define RENAME_H
+
+#endif
\ No newline at end of file
index bee9133bcac7daa08fe83b9a337f7e028dc96039..92eb7b3669397ca681248928e9e6038ac6a5d537 100644 (file)
@@ -1 +1,12 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 3.25.1)
\ No newline at end of file
+CMAKE_MINIMUM_REQUIRED(VERSION 3.25.1)
+
+FIND_LIBRARY(cmocka NAMES cmocka REQUIRED)
+
+INCLUDE(CTest)
+
+ADD_EXECUTABLE(rename_tests rename_tests.c)
+TARGET_LINK_LIBRARIES(rename_tests ${cmocka})
+
+ADD_TEST(NAME rename_tests COMMAND rename_tests)
+
+ADD_CUSTOM_TARGET(run_tests ALL ctest)
\ No newline at end of file
diff --git a/tests/rename_tests.c b/tests/rename_tests.c
new file mode 100644 (file)
index 0000000..29b0ed6
--- /dev/null
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+void sanity_check()
+{
+       assert_true(1);
+}
+
+int main()
+{
+       const struct CMUnitTest tests[] = {
+               cmocka_unit_test(sanity_check)
+       };
+
+       return cmocka_run_group_tests(tests, NULL, NULL);
+}
\ No newline at end of file