diff options
-rw-r--r-- | tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/test_expect_u_int_in_set.c | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e491f6d..2807116 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -18,6 +18,7 @@ endif() set(CMOCKA_TESTS test_alloc test_expect_check + test_expect_u_int_in_set test_expect_check_fail test_group_setup_assert test_group_setup_fail diff --git a/tests/test_expect_u_int_in_set.c b/tests/test_expect_u_int_in_set.c new file mode 100644 index 0000000..7e095a1 --- /dev/null +++ b/tests/test_expect_u_int_in_set.c @@ -0,0 +1,33 @@ +#include "config.h" + +#include <stdarg.h> +#include <stddef.h> +#include <setjmp.h> +#include <stdint.h> +#include <cmocka.h> +#include <cmocka_private.h> +#include <stdio.h> +#include <string.h> + + +static void mock_test_int(intmax_t value) +{ + check_expected(value); +} + +static void test_expect_int_in_set_count(void **state) +{ + intmax_t set[] = { -1, 0, 1 }; + (void)state; /* unused */ + + expect_int_in_set_count(mock_test_int, value, set, 1); + + mock_test_int(-1); +} + +int main(void) { + const struct CMUnitTest tests[] = { + cmocka_unit_test(test_expect_int_in_set_count)}; + + return cmocka_run_group_tests(tests, NULL, NULL); +} |