cmocka.h   cmocka.h 
skipping to change at line 85 skipping to change at line 85
#else #else
#define LargestIntegralTypePrintfFormat "%llx" #define LargestIntegralTypePrintfFormat "%llx"
#endif /* _WIN32 */ #endif /* _WIN32 */
#endif /* LargestIntegralTypePrintfFormat */ #endif /* LargestIntegralTypePrintfFormat */
/* Perform an unsigned cast to LargestIntegralType. */ /* Perform an unsigned cast to LargestIntegralType. */
#define cast_to_largest_integral_type(value) \ #define cast_to_largest_integral_type(value) \
((LargestIntegralType)((size_t)(value))) ((LargestIntegralType)((size_t)(value)))
/* Smallest integral type capable of holding a pointer. */ /* Smallest integral type capable of holding a pointer. */
#ifndef _UINTPTR_T #if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED)
#define _UINTPTR_T # if defined(_WIN32)
#ifdef _WIN32 /* WIN32 is an ILP32 platform */
typedef unsigned int uintptr_t;
/* WIN32 is an ILP32 platform */ # elif defined(_WIN64)
typedef unsigned long uintptr_t; typedef unsigned long int uintptr_t
# else /* _WIN32 */
/* what about 64-bit windows?
* what's the right preprocessor symbol?
typedef unsigned long long uintptr_t */
#else /* _WIN32 */
/* ILP32 and LP64 platforms */ /* ILP32 and LP64 platforms */
#ifdef __WORDSIZE /* glibc */ # ifdef __WORDSIZE /* glibc */
# if __WORDSIZE == 64 # if __WORDSIZE == 64
typedef unsigned long int uintptr_t; typedef unsigned long int uintptr_t;
# else # else
typedef unsigned int uintptr_t; typedef unsigned int uintptr_t;
# endif /* __WORDSIZE == 64 */ # endif /* __WORDSIZE == 64 */
#else /* __WORDSIZE */ # else /* __WORDSIZE */
# if defined(_LP64) || defined(_I32LPx)
# if defined(_LP64) || defined(_I32LPx) typedef unsigned long int uintptr_t;
typedef unsigned long int uintptr_t; # else
# else typedef unsigned int uintptr_t;
typedef unsigned int uintptr_t; # endif
# endif # endif /* __WORDSIZE */
# endif /* _WIN32 */
#endif /* __WORDSIZE */
# define _UINTPTR_T
#endif /* _WIN32 */ # define _UINTPTR_T_DEFINED
#endif /* _UINTPTR_T */ #endif /* !defined(_UINTPTR_T) || !defined(_UINTPTR_T_DEFINED) */
/* Perform an unsigned cast to uintptr_t. */ /* Perform an unsigned cast to uintptr_t. */
#define cast_to_pointer_integral_type(value) \ #define cast_to_pointer_integral_type(value) \
((uintptr_t)(value)) ((uintptr_t)(value))
/* Perform a cast of a pointer to uintmax_t */ /* Perform a cast of a pointer to uintmax_t */
#define cast_ptr_to_largest_integral_type(value) \ #define cast_ptr_to_largest_integral_type(value) \
cast_to_largest_integral_type(cast_to_pointer_integral_type(value)) cast_to_largest_integral_type(cast_to_pointer_integral_type(value))
/** /**
skipping to change at line 293 skipping to change at line 288
* *
* @see mock() * @see mock()
*/ */
void will_return_count(#function, void *value, int count); void will_return_count(#function, void *value, int count);
#else #else
#define will_return_count(function, value, count) \ #define will_return_count(function, value, count) \
_will_return(#function, __FILE__, __LINE__, \ _will_return(#function, __FILE__, __LINE__, \
cast_to_largest_integral_type(value), count) cast_to_largest_integral_type(value), count)
#endif #endif
#ifdef DOXYGEN
/**
* @brief Store a value that will be always returned by mock().
*
* @param[in] #function The function which should return the given value.
*
* @param[in] value The value to be returned by mock().
*
* This is equivalent to:
* @code
* will_return_count(function, value, -1);
* @endcode
*
* @see will_return_count()
* @see mock()
*/
void will_return_always(#function, void *value);
#else
#define will_return_always(function, value) \
will_return_count(function, (value), -1)
#endif
/** @} */ /** @} */
/** /**
* @defgroup cmocka_param Checking Parameters * @defgroup cmocka_param Checking Parameters
* @ingroup cmocka * @ingroup cmocka
* *
* Functionality to store expected values for mock function parameters. * Functionality to store expected values for mock function parameters.
* *
* In addition to storing the return values of mock functions, cmocka provi des * In addition to storing the return values of mock functions, cmocka provi des
* functionality to store expected values for mock function parameters usin g * functionality to store expected values for mock function parameters usin g
skipping to change at line 1246 skipping to change at line 1263
/** /**
* @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
.
*/
void fail_msg(const char *msg, ...);
#else
#define fail_msg(msg, ...) do { \
print_error("ERROR: " msg "\n", ##__VA_ARGS__); \
fail(); \
} while (0)
#endif
#ifdef DOXYGEN
/**
* @brief Generic method to run a single test. * @brief Generic method to run a single test.
* *
* @param[in] #function The function to test. * @param[in] #function The function to test.
* *
* @return 0 on success, 1 if an error occured. * @return 0 on success, 1 if an error occured.
* *
* @code * @code
* // A test case that does nothing and succeeds. * // A test case that does nothing and succeeds.
* void null_test_success(void **state) { * void null_test_success(void **state) {
* } * }
skipping to change at line 1270 skipping to change at line 1299
* @endcode * @endcode
*/ */
int run_test(#function); int run_test(#function);
#else #else
#define run_test(f) _run_test(#f, f, NULL, UNIT_TEST_FUNCTION_TYPE_TEST, NU LL) #define run_test(f) _run_test(#f, f, NULL, UNIT_TEST_FUNCTION_TYPE_TEST, NU LL)
#endif #endif
/** Initializes a UnitTest structure. */ /** Initializes a UnitTest structure. */
#define unit_test(f) { #f, f, UNIT_TEST_FUNCTION_TYPE_TEST } #define unit_test(f) { #f, f, UNIT_TEST_FUNCTION_TYPE_TEST }
#define _unit_test_setup(test, setup) \
{ #test "_" #setup, setup, UNIT_TEST_FUNCTION_TYPE_SETUP }
/** Initializes a UnitTest structure with a setup function. */ /** Initializes a UnitTest structure with a setup function. */
#define unit_test_setup(test, setup) \ #define unit_test_setup(test, setup) \
{ #test "_" #setup, setup, UNIT_TEST_FUNCTION_TYPE_SETUP } _unit_test_setup(test, setup), \
unit_test(test)
#define _unit_test_teardown(test, 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) \
{ #test "_" #teardown, teardown, UNIT_TEST_FUNCTION_TYPE_TEARDOWN } unit_test(test), \
_unit_test_teardown(test, 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), \
unit_test_teardown(test, teardown) _unit_test_teardown(test, teardown)
#ifdef DOXYGEN #ifdef DOXYGEN
/** /**
* @brief Run tests specified by an array of UnitTest structures. * @brief Run tests specified by an array of UnitTest structures.
* *
* @param[in] tests[] The array of unit tests to execute. * @param[in] tests[] The array of unit tests to execute.
* *
* @return 0 on success, 1 if an error occured. * @return 0 on success, 1 if an error occured.
* *
* @code * @code
 End of changes. 9 change blocks. 
34 lines changed or deleted 72 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/