8 #include "lib/global.h"
10 /*** typedefs(not structures) and defined constants **********************************************/
12 #define mctest_add_parameterized_test(tc_core, test_func, test_data_source) { \
13 tcase_add_loop_test (tc_core, test_func, 0, G_N_ELEMENTS (test_data_source)); \
16 #define mctest_assert_str_eq(actual_result, etalon_result) { \
17 g_assert_cmpstr (actual_result, ==, etalon_result); \
20 #define mctest_assert_ptr_eq(actual_pointer, etalon_pointer) { \
21 ck_assert_msg ( actual_pointer == etalon_pointer, \
22 "%s(%p) pointer should be equal to %s(%p)\n", \
23 #actual_pointer, actual_pointer, #etalon_pointer , etalon_pointer \
27 #define mctest_assert_ptr_ne(actual_pointer, etalon_pointer) { \
28 ck_assert_msg ( actual_pointer != etalon_pointer, \
29 "%s(%p) pointer should not be equal to %s(%p)\n", \
30 #actual_pointer, actual_pointer, #etalon_pointer , etalon_pointer \
34 #define mctest_assert_null(actual_pointer) { \
36 (void *) actual_pointer == NULL, \
37 "%s(%p) variable should be NULL", #actual_pointer, actual_pointer \
41 #define mctest_assert_not_null(actual_pointer) { \
43 (void *) actual_pointer != NULL, \
44 "%s(nil) variable should not be NULL", #actual_pointer \
48 #define mctest_assert_true(actual_pointer) { \
50 (int) actual_pointer != 0, \
51 "%s variable should be TRUE", #actual_pointer \
55 #define mctest_assert_false(actual_pointer) { \
57 (int) actual_pointer == 0, \
58 "%s variable should be FALSE", #actual_pointer \
63 * Define header for a parameterized test.
64 * Declare 'data' variable for access to the parameters in current iteration
66 #define START_PARAMETRIZED_TEST(name_test, struct_name) \
67 START_TEST (name_test) { \
68 const struct struct_name *data = &struct_name[_i];
71 * Define footer for a parameterized test.
73 #define END_PARAMETRIZED_TEST \
76 /*** enums ***************************************************************************************/
78 /*** structures declarations (and typedefs of structures)*****************************************/
80 /*** global variables defined in .c file *********************************************************/
82 /*** declarations of public functions ************************************************************/
84 /*** inline functions ****************************************************************************/
87 mctest_run_all (TCase
*tc_core
)
93 s
= suite_create (TEST_SUITE_NAME
);
94 suite_add_tcase (s
, tc_core
);
95 sr
= srunner_create (s
);
96 srunner_set_log (sr
, "-");
97 srunner_run_all (sr
, CK_ENV
);
98 number_failed
= srunner_ntests_failed (sr
);
101 return (number_failed
== 0) ? EXIT_SUCCESS
: EXIT_FAILURE
;
104 #endif /* MC__TEST */