meson: use get_variable() update to meson 0.51
[mesa-waffle.git] / third_party / cmocka / tests / test_fixtures.c
blob4597626d9d705af1148ee5c9c66134a4014820b4
1 #include <stdarg.h>
2 #include <stddef.h>
3 #include <setjmp.h>
4 #include <cmocka.h>
6 #include <stdlib.h>
8 static int setup_only(void **state)
10 *state = malloc(1);
12 return 0;
15 static int teardown_only(void **state)
17 free(*state);
19 return 0;
22 static void malloc_setup_test(void **state)
24 assert_non_null(*state);
25 free(*state);
28 static void malloc_teardown_test(void **state)
30 *state = malloc(1);
31 assert_non_null(*state);
34 int main(void) {
35 const struct CMUnitTest tests[] = {
36 cmocka_unit_test_setup(malloc_setup_test, setup_only),
37 cmocka_unit_test_setup(malloc_setup_test, setup_only),
38 cmocka_unit_test_teardown(malloc_teardown_test, teardown_only),
39 cmocka_unit_test_teardown(malloc_teardown_test, teardown_only),
40 cmocka_unit_test_teardown(malloc_teardown_test, teardown_only),
41 cmocka_unit_test_teardown(malloc_teardown_test, teardown_only),
44 return cmocka_run_group_tests(tests, NULL, NULL);