8 static int setup_fail(void **state) {
11 /* We need to fail in setup */
15 static void int_test_ignored(void **state) {
16 /* should not be called */
17 assert_non_null(*state);
20 static int setup_ok(void **state) {
23 answer = malloc(sizeof(int));
34 /* A test case that does check if an int is equal. */
35 static void int_test_success(void **state) {
38 assert_int_equal(*answer, 42);
41 static int teardown(void **state) {
48 const struct CMUnitTest tests[] = {
49 cmocka_unit_test_setup_teardown(int_test_ignored, setup_fail, teardown),
50 cmocka_unit_test_setup_teardown(int_test_success, setup_ok, teardown),
53 return cmocka_run_group_tests(tests, NULL, NULL);