Request to add return-statement in OP_ASSERT-macro
Mocking and unit testing tool for C and C++
Brought to you by:
pognibene
The OP_ASSERT macro simply does a return which makes it not usable inside non void functions. Can the following (feel free to change naming) macro be added?
#define OP_ASSERT_TRUE_WITH_RETURN(expected,returnValue) \
do { \
if(!((expected))) { \
snprintf(op_error_message, OP_MESSAGE_LENGTH, "ERROR : ASSERT failed in file %s at line %d", BASE_FILE, LINE); \
opmock_add_error_message((char *) op_error_message); \
opmock_test_error++; \
opmock_print_error_messages(); \
return returnValue; \
} \
} while ( 0 )
Anonymous