Update Spanish help and man.
[midnight-commander.git] / tests / mctest.h
blob4699acfe83caa254c2193f1f04dbad93080f04c0
1 #ifndef MC__TEST
2 #define MC__TEST
4 #include <config.h>
5 #include <check.h>
7 #include "lib/global.h"
9 /*** typedefs(not structures) and defined constants **********************************************/
11 #define mctest_add_parameterized_test(tc_core, test_func, test_data_source) {\
12 tcase_add_loop_test (tc_core, test_func, 0, \
13 sizeof (test_data_source) / sizeof (test_data_source[0])); \
16 #define mctest_assert_str_eq(actual_result, etalon_result) { \
17 g_assert_cmpstr (actual_result, ==, etalon_result); \
20 #define mctest_assert_int_eq(actual_result, etalon_result) { \
21 ck_assert_int_eq (actual_result, etalon_result); \
24 #define mctest_assert_int_ne(actual_result, etalon_result) { \
25 ck_assert_int_ne (actual_result, etalon_result); \
28 #define mctest_assert_ptr_eq(actual_pointer, etalon_pointer) { \
29 fail_unless ( actual_pointer == etalon_pointer, \
30 "%s(%p) pointer should be equal to %s(%p)\n", \
31 #actual_pointer, actual_pointer, #etalon_pointer , etalon_pointer \
32 );\
35 #define mctest_assert_ptr_ne(actual_pointer, etalon_pointer) { \
36 fail_unless ( actual_pointer != etalon_pointer, \
37 "%s(%p) pointer should not be equal to %s(%p)\n", \
38 #actual_pointer, actual_pointer, #etalon_pointer , etalon_pointer \
39 );\
42 #define mctest_assert_null(actual_pointer) { \
43 fail_unless( \
44 (void *) actual_pointer == NULL, \
45 "%s(%p) variable should be NULL", #actual_pointer, actual_pointer \
46 ); \
49 #define mctest_assert_not_null(actual_pointer) { \
50 fail_if( \
51 (void *) actual_pointer == NULL, \
52 "%s(nil) variable should not be NULL", #actual_pointer \
53 ); \
56 /**
57 * Define header for a parameterized test.
58 * Declare 'data' variable for access to the parameters in current iteration
60 #define START_PARAMETRIZED_TEST(name_test, struct_name) START_TEST (name_test) { const struct struct_name *data = &struct_name[_i];
62 /**
63 * Define footer for a parameterized test.
65 #define END_PARAMETRIZED_TEST } END_TEST
67 /*** enums ***************************************************************************************/
69 /*** structures declarations (and typedefs of structures)*****************************************/
71 /*** global variables defined in .c file *********************************************************/
73 /*** declarations of public functions ************************************************************/
75 /*** inline functions ****************************************************************************/
77 #endif /* MC__TEST */