add debug and gtest hook like as option
This commit is contained in:
@@ -108,16 +108,16 @@ extern struct list_base_fmock *g_list_base_fmock;
|
||||
PRINT_DEBUG(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>count call of %s: %ld\n",#namefunction,count_call_f);\
|
||||
struct list_mock_return_ ## namefunction *tmp_mock = &list_mo_ ## namefunction;\
|
||||
if( (tmp_mock->info_mock)->times_left == INITSTATE ){\
|
||||
PRINT_HK_C(colors_f[k_YELLOW],HK_TR," WARNING, %s, no EXPECT_MOCK_CALL or WILL_MOCK_CALL, but called %ld times.\n",#namefunction, count_call_f);\
|
||||
PRINT_HK_C(colors_f[k_YELLOW],tab_hk_f[hk_TR]," WARNING, %s, no EXPECT_MOCK_CALL or WILL_MOCK_CALL, but called %ld times.\n",#namefunction, count_call_f);\
|
||||
if(count_call_f==1){\
|
||||
PRINT_HK_C(colors_f[k_YELLOW],HK_TR," For instance:\n"\
|
||||
PRINT_HK_C(colors_f[k_YELLOW],tab_hk_f[hk_TR]," For instance:\n"\
|
||||
"%s EXPECT_MOCK_CALL(%s,%s,%s,true,1){\n"\
|
||||
"%s\t %s ret;\n%s \t ...do something with %s;\n"\
|
||||
"%s\t return ret;\n"\
|
||||
"%s }\n"\
|
||||
"%s if call once and accept all args, the same args with WILL_MOCK_CALL \n\n",\
|
||||
HK_TR, #returntype, #namefunction,#args_prototype_with_parenthesis, HK_TR,#returntype, \
|
||||
HK_TR, #args_call_with_parenthesis, HK_TR, HK_TR, HK_TR ); \
|
||||
tab_hk_f[hk_TR], #returntype, #namefunction,#args_prototype_with_parenthesis, tab_hk_f[hk_TR],#returntype, \
|
||||
tab_hk_f[hk_TR], #args_call_with_parenthesis, tab_hk_f[hk_TR], tab_hk_f[hk_TR], tab_hk_f[hk_TR] ); \
|
||||
/*return (returntype)0;*/ \
|
||||
INIT_MOCK_INFO_IF_NO_(tmp_mock,namefunction, PRE_ID);\
|
||||
}/* to have log */\
|
||||
@@ -129,15 +129,15 @@ extern struct list_base_fmock *g_list_base_fmock;
|
||||
append_variable_current(&((tmp_mock->info_mock)->l_current_var), tmp_mock->str_print_current_variables args_call_with_parenthesis);\
|
||||
}\
|
||||
else if(count_call_f == 1){\
|
||||
PRINT_HK_C(colors_f[k_YELLOW],HK_TR," no printer variable function defined, to define it:\n"\
|
||||
PRINT_HK_C(colors_f[k_YELLOW],tab_hk_f[hk_TR]," no printer variable function defined, to define it:\n"\
|
||||
"%s STR_PRINT_CUR_VAR(%s,%s,%s){\n"\
|
||||
"%s\t char* ret=malloc(256);/*for instance*/;\n"\
|
||||
"%s\t ... sprintf(ret,...., %s);/*for instance*/ \n"\
|
||||
"%s\t return ret;\n"\
|
||||
"%s }\n"\
|
||||
"%s same prototype as MOCK_FUNC whithout returntype which always char* i\n\n",\
|
||||
HK_TR, #namefunction,#args_prototype_with_parenthesis, #args_call_with_parenthesis, \
|
||||
HK_TR, HK_TR, #args_call_with_parenthesis, HK_TR, HK_TR, HK_TR ); \
|
||||
tab_hk_f[hk_TR], #namefunction,#args_prototype_with_parenthesis, #args_call_with_parenthesis, \
|
||||
tab_hk_f[hk_TR], tab_hk_f[hk_TR], #args_call_with_parenthesis, tab_hk_f[hk_TR], tab_hk_f[hk_TR], tab_hk_f[hk_TR] ); \
|
||||
}\
|
||||
/*LOG("condition_func:%d\n", tmp_mock->call_mock_condition args_call_with_parenthesis);*/ /*LOG("%s\n","failure condition");*/\
|
||||
/*EXPECT_EQ_TYPE_INT(1, tmp_mock->call_mock_condition args_call_with_parenthesis);*/ /*LOG("%s\n","failure condition");*/\
|
||||
@@ -145,13 +145,13 @@ extern struct list_base_fmock *g_list_base_fmock;
|
||||
/*return (returntype)0;*//* default return */\
|
||||
if( (tmp_mock->info_mock)->str_caller == NULL){ \
|
||||
if(count_call_f == 1){\
|
||||
PRINT_HK_C(colors_f[k_YELLOW],HK_TR," WARNING, no INIT_CALLER_MOCK; you can put it like this: \n"\
|
||||
PRINT_HK_C(colors_f[k_YELLOW],tab_hk_f[hk_TR]," WARNING, no INIT_CALLER_MOCK; you can put it like this: \n"\
|
||||
"%s TEST(nametest){\n"\
|
||||
"%s\t INIT_CALLER_MOCK(%s); \n"\
|
||||
"%s\t %s%s; \n"\
|
||||
"%s }\n"\
|
||||
"%s i.e before calling %s in this TEST, to have explicit logs\n",\
|
||||
HK_TR, HK_TR, #namefunction, HK_TR,#namefunction,#args_call_with_parenthesis, HK_TR, HK_TR, #namefunction);} \
|
||||
tab_hk_f[hk_TR], tab_hk_f[hk_TR], #namefunction, tab_hk_f[hk_TR],#namefunction,#args_call_with_parenthesis, tab_hk_f[hk_TR], tab_hk_f[hk_TR], #namefunction);} \
|
||||
/*return (returntype)0;*/ \
|
||||
}\
|
||||
else if (((tmp_mock->info_mock)->times_left != 0) && ((tmp_mock->info_mock)->times_left != INITSTATE )) {\
|
||||
@@ -164,7 +164,7 @@ extern struct list_base_fmock *g_list_base_fmock;
|
||||
}\
|
||||
/*if(0 == tmp_mock->call_mock_condition args_call_with_parenthesis){\
|
||||
PRINT_LOC("Failure, arguments not expected\ncondition ( %s ) not verified\n\n", (tmp_mock->info_mock)->str_conditions);\
|
||||
PRINT_HK_C(RED_K,HK_TR," 1 argument check failed from %s \n",__func__); \
|
||||
PRINT_HK_C(RED_K,tab_hk_f[hk_TR]," 1 argument check failed from %s \n",__func__); \
|
||||
}*/\
|
||||
PRINT_DEBUG(" %*c VALUES: mock function:%s, conditions:%s t_left:%ld, init_left:%ld| args:%s\n",8,'^',(tmp_mock->info_mock)->str_namefunc, (tmp_mock->info_mock)->str_conditions, (tmp_mock->info_mock)->times_left,(tmp_mock->info_mock)->init_times_left, #args_call_with_parenthesis);\
|
||||
if (((tmp_mock->info_mock)->times_left <= INFINITY) || ((tmp_mock->info_mock)->times_left > 0)){\
|
||||
|
||||
@@ -27,16 +27,16 @@
|
||||
#define SZ_TAB_HK 8
|
||||
|
||||
|
||||
#ifdef HK
|
||||
#define HK_EQ "[==========]"
|
||||
#define HK_TR "[----------]"
|
||||
#define HK_RN "[RUN ]"
|
||||
#define HK_DN "[ DONE]"
|
||||
#define HK_OK "[ OK ]"
|
||||
#define HK_FL "[ FAILED ]"
|
||||
#define HK_PS "[ PASSED ]"
|
||||
#define HK_SK "[ SKIP ]"
|
||||
#else
|
||||
/*#ifdef HK*/
|
||||
#define gHK_EQ "[==========]"
|
||||
#define gHK_TR "[----------]"
|
||||
#define gHK_RN "[RUN ]"
|
||||
#define gHK_DN "[ DONE]"
|
||||
#define gHK_OK "[ OK ]"
|
||||
#define gHK_FL "[ FAILED ]"
|
||||
#define gHK_PS "[ PASSED ]"
|
||||
#define gHK_SK "[ SKIP ]"
|
||||
/*#else*/
|
||||
#define HK_EQ "=========="
|
||||
#define HK_TR "----------"
|
||||
#define HK_RN "====== RUN"
|
||||
@@ -45,7 +45,7 @@
|
||||
#define HK_FL "===== FAIL"
|
||||
#define HK_PS "===== PASS"
|
||||
#define HK_SK "===== SKIP"
|
||||
#endif /* HK */
|
||||
/*#endif*/ /* HK */
|
||||
|
||||
/*
|
||||
* compare symbol
|
||||
@@ -59,9 +59,11 @@
|
||||
|
||||
|
||||
extern FILE **f_ou_th;
|
||||
extern bool debug;
|
||||
extern bool unicolour;
|
||||
extern bool ordered;
|
||||
extern bool log_parallel;
|
||||
extern bool only_usage;
|
||||
extern char *savelog;
|
||||
|
||||
extern char *colors_f[];
|
||||
@@ -131,14 +133,15 @@ extern char *varHK_EQ, *varHK_TR, *varHK_RN, *varHK_DN, *varHK_OK, *varHK_FL, *v
|
||||
#define PRINT_HK_C(color,hk,fmt,...)\
|
||||
PRINTF("%s%s%s" fmt, color,hk,colors_f[k_DEFAULT],__VA_ARGS__)
|
||||
|
||||
|
||||
#define PRINT_DEBUG(fmt, ...)\
|
||||
do{ if(debug) PRINT_LOC(fmt, __VA_ARGS__);} while(0)
|
||||
|
||||
|
||||
/*
|
||||
* to skip the bloc test function
|
||||
*/
|
||||
#define SKIP(fmt,...)\
|
||||
PRINT_HK_C(colors_f[k_GREEN], HK_SK, fmt, ## __VA_ARGS__);\
|
||||
PRINT_HK_C(colors_f[k_GREEN], tab_hk_f[hk_SK], fmt, ## __VA_ARGS__);\
|
||||
PRINT_LOC("%s\n\n" DEFAULT_K," Skiped "); return;
|
||||
|
||||
|
||||
@@ -307,26 +310,26 @@ GEN_EXPECTED_OP_TYPE_FUNC(NE, TYPE_STRING)
|
||||
do{ \
|
||||
if(is_parallel_nb == 0){\
|
||||
if(expected_##OP##_##type(var1, var2)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 %s passed %s \n\n",name_f,msg_call); \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 %s passed %s \n\n",name_f,msg_call); \
|
||||
} \
|
||||
else{ \
|
||||
/*PRINT_LOC("Failure\nExpected %s of these values:\n %s\n\tWhich is: %s\n %s\n\tWhich is: %s\n\n"\
|
||||
,DESCRIPTION_##OP,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2)); */ \
|
||||
PRINT_LOC("Failure\nExpected: (%s) %s (%s) :\n Value of %s: %s \n Value of %s: %s\n\n"\
|
||||
,#var1,STRFY(OP),#var2,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2)); \
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 %s failed %s \n",name_f,msg_call); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 %s failed %s \n",name_f,msg_call); \
|
||||
} \
|
||||
}else { \
|
||||
if(expected_##OP##_name_##type(var1, var2, name_f)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 %s passed %s \n\n",name_f,msg_call); \
|
||||
/*PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 test passed %s \n\n",name_f);*/ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 %s passed %s \n\n",name_f,msg_call); \
|
||||
/*PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 test passed %s \n\n",name_f);*/ \
|
||||
} \
|
||||
else{ \
|
||||
/*PRINT_LOC("Failure\nExpected %s of these values:\n %s\n\tWhich is: %s\n %s\n\tWhich is: %s\n\n"\
|
||||
,DESCRIPTION_##OP ,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2));*/ \
|
||||
PRINT_LOC("Failure\nExpected: (%s) %s (%s) :\n Value of %s: %s \n Value of %s: %s\n\n"\
|
||||
,#var1,STRFY(OP),#var2,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2)); \
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 %s failed %s \n",name_f,msg_call); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 %s failed %s \n",name_f,msg_call); \
|
||||
} \
|
||||
}\
|
||||
}while(0);
|
||||
@@ -341,26 +344,26 @@ do{ \
|
||||
do{ \
|
||||
if(is_parallel_nb == 0){\
|
||||
if(expected_##OP##_##type(var1, var2)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 test passed from %s \n\n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 test passed from %s \n\n",__func__); \
|
||||
} \
|
||||
else{ \
|
||||
/*PRINT_LOC("Failure\nExpected %s of these values:\n %s\n\tWhich is: %s\n %s\n\tWhich is: %s\n\n"\
|
||||
,DESCRIPTION_##OP,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2)); */ \
|
||||
PRINT_LOC("Failure\nExpected: (%s) %s (%s) :\n Value of %s: %s \n Value of %s: %s\n\n"\
|
||||
,#var1,STRFY(OP),#var2,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2)); \
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 test failed from %s \n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 test failed from %s \n",__func__); \
|
||||
if(is_assert) return; \
|
||||
} \
|
||||
}else { \
|
||||
if(expected_##OP##_name_##type(var1, var2, __func__)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 test passed from %s \n\n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 test passed from %s \n\n",__func__); \
|
||||
} \
|
||||
else{ \
|
||||
/*PRINT_LOC("Failure\nExpected %s of these values:\n %s\n\tWhich is: %s\n %s\n\tWhich is: %s\n\n"\
|
||||
,DESCRIPTION_##OP ,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2));*/ \
|
||||
PRINT_LOC("Failure\nExpected: (%s) %s (%s) :\n Value of %s: %s \n Value of %s: %s\n\n"\
|
||||
,#var1,STRFY(OP),#var2,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2)); \
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 test failed from %s \n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 test failed from %s \n",__func__); \
|
||||
if(is_assert) return; \
|
||||
} \
|
||||
}\
|
||||
@@ -375,25 +378,25 @@ do{ \
|
||||
do{ \
|
||||
if(is_parallel_nb == 0){\
|
||||
if(expected_##OP##_##type(var1, var2)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 test passed from %s \n\n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 test passed from %s \n\n",__func__); \
|
||||
} \
|
||||
else{ \
|
||||
/*PRINT_LOC("Failure\nExpected %s of these values:\n %s\n\tWhich is: %s\n %s\n\tWhich is: %s\n\n"\
|
||||
,DESCRIPTION_##OP,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2)); */ \
|
||||
PRINT_LOC("Failure\nExpected: (%s) %s (%s) :\n Value of %s: %s \n Value of %s: %s\n\n"\
|
||||
,#var1,STRFY(OP),#var2,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2)); \
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 test failed from %s \n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 test failed from %s \n",__func__); \
|
||||
} \
|
||||
}else { \
|
||||
if(expected_##OP##_name_##type(var1, var2, __func__)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 test passed from %s \n\n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 test passed from %s \n\n",__func__); \
|
||||
} \
|
||||
else{ \
|
||||
/*PRINT_LOC("Failure\nExpected %s of these values:\n %s\n\tWhich is: %s\n %s\n\tWhich is: %s\n\n"\
|
||||
,DESCRIPTION_##OP ,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2));*/ \
|
||||
PRINT_LOC("Failure\nExpected: (%s) %s (%s) :\n Value of %s: %s \n Value of %s: %s\n\n"\
|
||||
,#var1,STRFY(OP),#var2,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2)); \
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 test failed from %s \n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 test failed from %s \n",__func__); \
|
||||
} \
|
||||
}\
|
||||
}while(0);
|
||||
@@ -402,26 +405,26 @@ do{ \
|
||||
do{ \
|
||||
if(is_parallel_nb == 0){\
|
||||
if(expected_##OP##_##type(var1, var2)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 test passed from %s \n\n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 test passed from %s \n\n",__func__); \
|
||||
} \
|
||||
else{ \
|
||||
/*PRINT_LOC("Failure\nExpected %s of these values:\n %s\n\tWhich is: %s\n %s\n\tWhich is: %s\n\n"\
|
||||
,DESCRIPTION_##OP,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2)); */ \
|
||||
PRINT_LOC("Failure\nExpected: (%s) %s (%s) :\n Value of %s: %s \n Value of %s: %s\n\n"\
|
||||
,#var1,STRFY(OP),#var2,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2)); \
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 test failed from %s \n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 test failed from %s \n",__func__); \
|
||||
return; \
|
||||
} \
|
||||
}else { \
|
||||
if(expected_##OP##_name_##type(var1, var2, __func__)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 test passed from %s \n\n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 test passed from %s \n\n",__func__); \
|
||||
} \
|
||||
else{ \
|
||||
/*PRINT_LOC("Failure\nExpected %s of these values:\n %s\n\tWhich is: %s\n %s\n\tWhich is: %s\n\n"\
|
||||
,DESCRIPTION_##OP ,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2));*/ \
|
||||
PRINT_LOC("Failure\nExpected: (%s) %s (%s) :\n Value of %s: %s \n Value of %s: %s\n\n"\
|
||||
,#var1,STRFY(OP),#var2,#var1, type##_TO_STR(var1), #var2, type##_TO_STR(var2)); \
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 test failed from %s \n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 test failed from %s \n",__func__); \
|
||||
return; \
|
||||
} \
|
||||
}\
|
||||
@@ -667,21 +670,21 @@ do{ \
|
||||
do{ \
|
||||
if(is_parallel_nb==0){\
|
||||
if(expected_##expect##_f(var1)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 test passed from %s \n\n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 test passed from %s \n\n",__func__); \
|
||||
} \
|
||||
else{ \
|
||||
PRINT_LOC("Failure\nValue of: %s\nActual: %s\nExpected: %s\n\n", #var1, #not_expect, #expect);\
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 test failed from %s \n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 test failed from %s \n",__func__); \
|
||||
if(is_assert) return; \
|
||||
} \
|
||||
}\
|
||||
else{\
|
||||
if(expected_##expect##_f_name(var1, __func__)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 test passed from %s \n\n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 test passed from %s \n\n",__func__); \
|
||||
} \
|
||||
else{ \
|
||||
PRINT_LOC("Failure\nValue of: %s\nActual: %s\nExpected: %s\n\n", #var1, #not_expect, #expect);\
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 test failed from %s \n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 test failed from %s \n",__func__); \
|
||||
if(is_assert) return; \
|
||||
} \
|
||||
}\
|
||||
@@ -695,21 +698,21 @@ do{
|
||||
do{ \
|
||||
if(is_parallel_nb==0){ \
|
||||
if(expected_##expect##_f(var1)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 test passed from %s \n\n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 test passed from %s \n\n",__func__); \
|
||||
} \
|
||||
else{ \
|
||||
PRINT_LOC("Failure\nValue of: %s\nActual: %s\nExpected: %s\n", #var1, #not_expect, #expect); \
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 test failed from %s \n\n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 test failed from %s \n\n",__func__); \
|
||||
} \
|
||||
} \
|
||||
else{ \
|
||||
size_t id_thread=id_of_thread_executed(); \
|
||||
if(expected_##expect##_f_name(var1, __func__)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 test passed from %s, on thread[%ld]\n\n",__func__,id_thread); \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 test passed from %s, on thread[%ld]\n\n",__func__,id_thread); \
|
||||
} \
|
||||
else{ \
|
||||
PRINT_LOC("Failure\nValue of: %s\nActual: %s\nExpected: %s\n", #var1, #not_expect, #expect); \
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 test failed from %s, on thread[%ld]\n\n",__func__,id_thread); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 test failed from %s, on thread[%ld]\n\n",__func__,id_thread); \
|
||||
} \
|
||||
} \
|
||||
}while(0);
|
||||
@@ -719,22 +722,22 @@ do{
|
||||
do{ \
|
||||
if(is_parallel_nb==0){ \
|
||||
if(expected_##expect##_f(var1)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 test passed from %s \n\n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 test passed from %s \n\n",__func__); \
|
||||
} \
|
||||
else{ \
|
||||
PRINT_LOC("Failure\nValue of: %s\nActual: %s\nExpected: %s\n", #var1, #not_expect, #expect); \
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 test failed from %s \n\n",__func__); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 test failed from %s \n\n",__func__); \
|
||||
return; \
|
||||
} \
|
||||
}\
|
||||
else{\
|
||||
size_t id_thread=id_of_thread_executed(); \
|
||||
if(expected_##expect##_f_name(var1, __func__)){ \
|
||||
PRINT_HK_C(colors_f[k_GREEN],HK_TR," 1 test passed from %s, on thread[%ld]\n\n",__func__,id_thread); \
|
||||
PRINT_HK_C(colors_f[k_GREEN],tab_hk_f[hk_TR]," 1 test passed from %s, on thread[%ld]\n\n",__func__,id_thread); \
|
||||
} \
|
||||
else{ \
|
||||
PRINT_LOC("Failure\nValue of: %s\nActual: %s\nExpected: %s\n\n", #var1, #not_expect, #expect);\
|
||||
PRINT_HK_C(colors_f[k_RED],HK_TR," 1 test failed from %s, on thread[%ld]\n\n",__func__, id_thread); \
|
||||
PRINT_HK_C(colors_f[k_RED],tab_hk_f[hk_TR]," 1 test failed from %s, on thread[%ld]\n\n",__func__, id_thread); \
|
||||
return; \
|
||||
} \
|
||||
}\
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
// to define DEBUG in gcc cli do: gcc -D DEBUG=1 or 0 if need!
|
||||
#ifndef DEBUG
|
||||
#define DEBUG 0
|
||||
@@ -45,7 +46,7 @@ void gotoxy(int x, int y);
|
||||
do { if (DEBUG) fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
|
||||
__LINE__, __func__, __VA_ARGS__); } while (0)
|
||||
|
||||
#define PRINT_DEBUG(fmt, ...) \
|
||||
#define PRINT_DEBUG_(fmt, ...) \
|
||||
do { if (DEBUG) fprintf(F_ERR, "%s:%d:%s(): " fmt, __FILE__, \
|
||||
__LINE__, __func__, __VA_ARGS__); } while (0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user