summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/CMakeLists.txt8
-rw-r--r--tests/test_group_setup_assert.c37
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index faaa604..4b015ba 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -8,6 +8,7 @@ include_directories(
set(CMOCKA_TESTS
test_alloc
+ test_group_setup_assert
test_group_setup_fail
test_fixtures
test_group_fixtures
@@ -80,6 +81,13 @@ set_tests_properties(
)
set_tests_properties(
+ test_group_setup_assert
+ PROPERTIES
+ WILL_FAIL
+ 1
+)
+
+set_tests_properties(
test_group_setup_fail
PROPERTIES
WILL_FAIL
diff --git a/tests/test_group_setup_assert.c b/tests/test_group_setup_assert.c
new file mode 100644
index 0000000..eef61f8
--- /dev/null
+++ b/tests/test_group_setup_assert.c
@@ -0,0 +1,37 @@
+/* Use the unit test allocators */
+#define UNIT_TESTING 1
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+static int group_setup_failing(void **state)
+{
+ (void) state; /* unused */
+
+ assert_int_equal(0, 1);
+
+ return 0;
+}
+
+static void test_true(void **state)
+{
+ (void) state; /* unused */
+ assert_true(1);
+}
+
+static void test_false(void **state)
+{
+ (void) state; /* unused */
+ assert_false(0);
+}
+
+int main(void) {
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(test_true),
+ cmocka_unit_test(test_false),
+ };
+
+ return cmocka_run_group_tests(tests, group_setup_failing, NULL);
+}