cmocka.h | cmocka.h | |||
---|---|---|---|---|
skipping to change at line 391 | skipping to change at line 391 | |||
* @param[in] #parameter The parameters passed to the function. | * @param[in] #parameter The parameters passed to the function. | |||
* | * | |||
* @param[in] #check_function The check function to call. | * @param[in] #check_function The check function to call. | |||
* | * | |||
* @param[in] check_data The data to pass to the check function. | * @param[in] check_data The data to pass to the check function. | |||
*/ | */ | |||
void expect_check(#function, #parameter, #check_function, const void *check _data); | void expect_check(#function, #parameter, #check_function, const void *check _data); | |||
#else | #else | |||
#define expect_check(function, parameter, check_function, check_data) \ | #define expect_check(function, parameter, check_function, check_data) \ | |||
_expect_check(#function, #parameter, __FILE__, __LINE__, check_function , \ | _expect_check(#function, #parameter, __FILE__, __LINE__, check_function , \ | |||
cast_to_largest_integral_type(check_data), NULL, 0) | cast_to_largest_integral_type(check_data), NULL, 1) | |||
#endif | #endif | |||
#ifdef DOXYGEN | #ifdef DOXYGEN | |||
/** | /** | |||
* @brief Add an event to check if the parameter value is part of the provi ded | * @brief Add an event to check if the parameter value is part of the provi ded | |||
* array. | * array. | |||
* | * | |||
* The event is triggered by calling check_expected() in the mocked functio n. | * The event is triggered by calling check_expected() in the mocked functio n. | |||
* | * | |||
* @param[in] #function The function to add the check for. | * @param[in] #function The function to add the check for. | |||
skipping to change at line 1294 | skipping to change at line 1294 | |||
* @brief Forces the test to fail immediately and quit. | * @brief Forces the test to fail immediately and quit. | |||
*/ | */ | |||
void fail(void); | void fail(void); | |||
#else | #else | |||
#define fail() _fail(__FILE__, __LINE__) | #define fail() _fail(__FILE__, __LINE__) | |||
#endif | #endif | |||
#ifdef DOXYGEN | #ifdef DOXYGEN | |||
/** | /** | |||
* @brief Forces the test to fail immediately and quit, printing the reason . | * @brief Forces the test to fail immediately and quit, printing the reason . | |||
* | ||||
* @code | ||||
* fail_msg("This is some error message for test"); | ||||
* @endcode | ||||
* | ||||
* or | ||||
* | ||||
* @code | ||||
* char *error_msg = "This is some error message for test"; | ||||
* fail_msg("%s", error_msg); | ||||
* @endcode | ||||
*/ | */ | |||
void fail_msg(const char *msg, ...); | void fail_msg(const char *msg, ...); | |||
#else | #else | |||
#define fail_msg(msg, ...) do { \ | #define fail_msg(msg, ...) do { \ | |||
print_error("ERROR: " msg "\n", ##__VA_ARGS__); \ | print_error("ERROR: " msg "\n", ##__VA_ARGS__); \ | |||
fail(); \ | fail(); \ | |||
} while (0) | } while (0) | |||
#endif | #endif | |||
#ifdef DOXYGEN | #ifdef DOXYGEN | |||
skipping to change at line 1351 | skipping to change at line 1362 | |||
#define _unit_test_teardown(test, teardown) \ | #define _unit_test_teardown(test, teardown) \ | |||
{ #test "_" #teardown, teardown, UNIT_TEST_FUNCTION_TYPE_TEARDOWN } | { #test "_" #teardown, teardown, UNIT_TEST_FUNCTION_TYPE_TEARDOWN } | |||
/** Initializes a UnitTest structure with a teardown function. */ | /** Initializes a UnitTest structure with a teardown function. */ | |||
#define unit_test_teardown(test, teardown) \ | #define unit_test_teardown(test, teardown) \ | |||
_unit_test_setup(test, _unit_test_dummy), \ | _unit_test_setup(test, _unit_test_dummy), \ | |||
unit_test(test), \ | unit_test(test), \ | |||
_unit_test_teardown(test, teardown) | _unit_test_teardown(test, teardown) | |||
/** Initializes a UnitTest structure for a group setup function. */ | ||||
#define group_test_setup(setup) \ | #define group_test_setup(setup) \ | |||
{ "group_" #setup, setup, UNIT_TEST_FUNCTION_TYPE_GROUP_SETUP } | { "group_" #setup, setup, UNIT_TEST_FUNCTION_TYPE_GROUP_SETUP } | |||
/** Initializes a UnitTest structure for a group teardown function. */ | ||||
#define group_test_teardown(teardown) \ | #define group_test_teardown(teardown) \ | |||
{ "group_" #teardown, teardown, UNIT_TEST_FUNCTION_TYPE_GROUP_TEARDOWN } | { "group_" #teardown, teardown, UNIT_TEST_FUNCTION_TYPE_GROUP_TEARDOWN } | |||
/** | /** | |||
* Initialize an array of UnitTest structures with a setup function for a t est | * Initialize an array of UnitTest structures with a setup function for a t est | |||
* and a teardown function. Either setup or teardown can be NULL. | * and a teardown function. Either setup or teardown can be NULL. | |||
*/ | */ | |||
#define unit_test_setup_teardown(test, setup, teardown) \ | #define unit_test_setup_teardown(test, setup, teardown) \ | |||
_unit_test_setup(test, setup), \ | _unit_test_setup(test, setup), \ | |||
unit_test(test), \ | unit_test(test), \ | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 14 lines changed or added | |||