22 #define __func__ __FUNCTION__ 25 #define inline __inline 32 int __stdcall IsDebuggerPresent();
59 # if defined(__x86_64__) && !defined(__ILP32__) 60 # define __WORDSIZE 64 62 # define __WORDSIZE 32 73 #ifndef LargestIntegralType 75 # define LargestIntegralType unsigned long int 77 # define LargestIntegralType unsigned long long int 83 #ifndef LargestIntegralTypePrintfFormat 85 # define LargestIntegralTypePrintfFormat "0x%I64x" 88 # define LargestIntegralTypePrintfFormat "%#lx" 90 # define LargestIntegralTypePrintfFormat "%#llx" 96 #define cast_to_largest_integral_type(value) \ 97 ((LargestIntegralType)(value)) 100 #if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED) 103 typedef unsigned int uintptr_t;
104 # elif defined(_WIN64) 105 typedef unsigned long int uintptr_t
110 # if __WORDSIZE == 64 111 typedef unsigned long int uintptr_t;
113 typedef unsigned int uintptr_t;
116 # if defined(_LP64) || defined(_I32LPx) 117 typedef unsigned long int uintptr_t;
119 typedef unsigned int uintptr_t;
125 # define _UINTPTR_T_DEFINED 129 #define cast_to_pointer_integral_type(value) \ 130 ((uintptr_t)((size_t)(value))) 133 #define cast_ptr_to_largest_integral_type(value) \ 134 cast_to_largest_integral_type(cast_to_pointer_integral_type(value)) 138 #define CMOCKA_PRINTF_ATTRIBUTE(a,b) \ 139 __attribute__ ((__format__ (__printf__, a, b))) 141 #define CMOCKA_PRINTF_ATTRIBUTE(a,b) 144 #if defined(__GNUC__) 145 #define CMOCKA_DEPRECATED __attribute__ ((deprecated)) 146 #elif defined(_MSC_VER) 147 #define CMOCKA_DEPRECATED __declspec(deprecated) 149 #define CMOCKA_DEPRECATED 210 #define mock() _mock(__func__, __FILE__, __LINE__) 234 #type mock_type(#type); 236 #define mock_type(type) ((type) mock()) 263 #define mock_ptr_type(type) ((type) (uintptr_t) mock()) 294 #define will_return(function, value) \ 295 _will_return(#function, __FILE__, __LINE__, \ 296 cast_to_largest_integral_type(value), 1) 315 #define will_return_count(function, value, count) \ 316 _will_return(#function, __FILE__, __LINE__, \ 317 cast_to_largest_integral_type(value), count) 338 #define will_return_always(function, value) \ 339 will_return_count(function, (value), -1) 411 void expect_check(#
function, #parameter, #check_function,
const void *check_data);
413 #define expect_check(function, parameter, check_function, check_data) \ 414 _expect_check(#function, #parameter, __FILE__, __LINE__, check_function, \ 415 cast_to_largest_integral_type(check_data), NULL, 1) 435 #define expect_in_set(function, parameter, value_array) \ 436 expect_in_set_count(function, parameter, value_array, 1) 460 #define expect_in_set_count(function, parameter, value_array, count) \ 461 _expect_in_set(#function, #parameter, __FILE__, __LINE__, value_array, \ 462 sizeof(value_array) / sizeof((value_array)[0]), count) 482 #define expect_not_in_set(function, parameter, value_array) \ 483 expect_not_in_set_count(function, parameter, value_array, 1) 507 #define expect_not_in_set_count(function, parameter, value_array, count) \ 508 _expect_not_in_set( \ 509 #function, #parameter, __FILE__, __LINE__, value_array, \ 510 sizeof(value_array) / sizeof((value_array)[0]), count) 533 #define expect_in_range(function, parameter, minimum, maximum) \ 534 expect_in_range_count(function, parameter, minimum, maximum, 1) 560 #define expect_in_range_count(function, parameter, minimum, maximum, count) \ 561 _expect_in_range(#function, #parameter, __FILE__, __LINE__, minimum, \ 584 #define expect_not_in_range(function, parameter, minimum, maximum) \ 585 expect_not_in_range_count(function, parameter, minimum, maximum, 1) 611 #define expect_not_in_range_count(function, parameter, minimum, maximum, \ 613 _expect_not_in_range(#function, #parameter, __FILE__, __LINE__, \ 614 minimum, maximum, count) 633 #define expect_value(function, parameter, value) \ 634 expect_value_count(function, parameter, value, 1) 657 #define expect_value_count(function, parameter, value, count) \ 658 _expect_value(#function, #parameter, __FILE__, __LINE__, \ 659 cast_to_largest_integral_type(value), count) 678 #define expect_not_value(function, parameter, value) \ 679 expect_not_value_count(function, parameter, value, 1) 702 #define expect_not_value_count(function, parameter, value, count) \ 703 _expect_not_value(#function, #parameter, __FILE__, __LINE__, \ 704 cast_to_largest_integral_type(value), count) 722 void expect_string(#
function, #parameter,
const char *
string);
724 #define expect_string(function, parameter, string) \ 725 expect_string_count(function, parameter, string, 1) 749 #define expect_string_count(function, parameter, string, count) \ 750 _expect_string(#function, #parameter, __FILE__, __LINE__, \ 751 (const char*)(string), count) 771 #define expect_not_string(function, parameter, string) \ 772 expect_not_string_count(function, parameter, string, 1) 796 #define expect_not_string_count(function, parameter, string, count) \ 797 _expect_not_string(#function, #parameter, __FILE__, __LINE__, \ 798 (const char*)(string), count) 817 void expect_memory(#
function, #parameter,
void *memory,
size_t size);
819 #define expect_memory(function, parameter, memory, size) \ 820 expect_memory_count(function, parameter, memory, size, 1) 846 #define expect_memory_count(function, parameter, memory, size, count) \ 847 _expect_memory(#function, #parameter, __FILE__, __LINE__, \ 848 (const void*)(memory), size, count) 870 #define expect_not_memory(function, parameter, memory, size) \ 871 expect_not_memory_count(function, parameter, memory, size, 1) 897 #define expect_not_memory_count(function, parameter, memory, size, count) \ 898 _expect_not_memory(#function, #parameter, __FILE__, __LINE__, \ 899 (const void*)(memory), size, count) 917 #define expect_any(function, parameter) \ 918 expect_any_count(function, parameter, 1) 940 #define expect_any_count(function, parameter, count) \ 941 _expect_any(#function, #parameter, __FILE__, __LINE__, count) 957 #define check_expected(parameter) \ 958 _check_expected(__func__, #parameter, __FILE__, __LINE__, \ 959 cast_to_largest_integral_type(parameter)) 975 #define check_expected_ptr(parameter) \ 976 _check_expected(__func__, #parameter, __FILE__, __LINE__, \ 977 cast_ptr_to_largest_integral_type(parameter)) 1016 #define assert_true(c) _assert_true(cast_to_largest_integral_type(c), #c, \ 1034 #define assert_false(c) _assert_true(!(cast_to_largest_integral_type(c)), #c, \ 1053 #define assert_return_code(rc, error) \ 1054 _assert_return_code(cast_to_largest_integral_type(rc), \ 1056 cast_to_largest_integral_type(error), \ 1057 #rc, __FILE__, __LINE__) 1073 #define assert_non_null(c) _assert_true(cast_ptr_to_largest_integral_type(c), #c, \ 1090 #define assert_null(c) _assert_true(!(cast_ptr_to_largest_integral_type(c)), #c, \ 1107 #define assert_ptr_equal(a, b) \ 1108 _assert_int_equal(cast_ptr_to_largest_integral_type(a), \ 1109 cast_ptr_to_largest_integral_type(b), \ 1126 #define assert_ptr_not_equal(a, b) \ 1127 _assert_int_not_equal(cast_ptr_to_largest_integral_type(a), \ 1128 cast_ptr_to_largest_integral_type(b), \ 1145 #define assert_int_equal(a, b) \ 1146 _assert_int_equal(cast_to_largest_integral_type(a), \ 1147 cast_to_largest_integral_type(b), \ 1166 #define assert_int_not_equal(a, b) \ 1167 _assert_int_not_equal(cast_to_largest_integral_type(a), \ 1168 cast_to_largest_integral_type(b), \ 1185 #define assert_string_equal(a, b) \ 1186 _assert_string_equal((const char*)(a), (const char*)(b), __FILE__, \ 1203 #define assert_string_not_equal(a, b) \ 1204 _assert_string_not_equal((const char*)(a), (const char*)(b), __FILE__, \ 1225 #define assert_memory_equal(a, b, size) \ 1226 _assert_memory_equal((const void*)(a), (const void*)(b), size, __FILE__, \ 1247 #define assert_memory_not_equal(a, b, size) \ 1248 _assert_memory_not_equal((const void*)(a), (const void*)(b), size, \ 1268 #define assert_in_range(value, minimum, maximum) \ 1270 cast_to_largest_integral_type(value), \ 1271 cast_to_largest_integral_type(minimum), \ 1272 cast_to_largest_integral_type(maximum), __FILE__, __LINE__) 1291 #define assert_not_in_range(value, minimum, maximum) \ 1292 _assert_not_in_range( \ 1293 cast_to_largest_integral_type(value), \ 1294 cast_to_largest_integral_type(minimum), \ 1295 cast_to_largest_integral_type(maximum), __FILE__, __LINE__) 1313 #define assert_in_set(value, values, number_of_values) \ 1314 _assert_in_set(value, values, number_of_values, __FILE__, __LINE__) 1332 #define assert_not_in_set(value, values, number_of_values) \ 1333 _assert_not_in_set(value, values, number_of_values, __FILE__, __LINE__) 1370 #define fail() _fail(__FILE__, __LINE__) 1379 #define skip() _skip(__FILE__, __LINE__) 1397 void fail_msg(
const char *msg, ...);
1399 #define fail_msg(msg, ...) do { \ 1400 print_error("ERROR: " msg "\n", ##__VA_ARGS__); \ 1427 #define run_test(f) _run_test(#f, f, NULL, UNIT_TEST_FUNCTION_TYPE_TEST, NULL) 1430 static inline void _unit_test_dummy(
void **state) {
1438 #define unit_test(f) { #f, f, UNIT_TEST_FUNCTION_TYPE_TEST } 1440 #define _unit_test_setup(test, setup) \ 1441 { #test "_" #setup, setup, UNIT_TEST_FUNCTION_TYPE_SETUP } 1447 #define unit_test_setup(test, setup) \ 1448 _unit_test_setup(test, setup), \ 1450 _unit_test_teardown(test, _unit_test_dummy) 1452 #define _unit_test_teardown(test, teardown) \ 1453 { #test "_" #teardown, teardown, UNIT_TEST_FUNCTION_TYPE_TEARDOWN } 1459 #define unit_test_teardown(test, teardown) \ 1460 _unit_test_setup(test, _unit_test_dummy), \ 1462 _unit_test_teardown(test, teardown) 1468 #define group_test_setup(setup) \ 1469 { "group_" #setup, setup, UNIT_TEST_FUNCTION_TYPE_GROUP_SETUP } 1475 #define group_test_teardown(teardown) \ 1476 { "group_" #teardown, teardown, UNIT_TEST_FUNCTION_TYPE_GROUP_TEARDOWN } 1485 #define unit_test_setup_teardown(test, setup, teardown) \ 1486 _unit_test_setup(test, setup), \ 1488 _unit_test_teardown(test, teardown) 1492 #define cmocka_unit_test(f) { #f, f, NULL, NULL } 1495 #define cmocka_unit_test_setup(f, setup) { #f, f, setup, NULL } 1498 #define cmocka_unit_test_teardown(f, teardown) { #f, f, NULL, teardown } 1504 #define cmocka_unit_test_setup_teardown(f, setup, teardown) { #f, f, setup, teardown } 1506 #define run_tests(tests) _run_tests(tests, sizeof(tests) / sizeof(tests)[0]) 1507 #define run_group_tests(tests) _run_group_tests(tests, sizeof(tests) / sizeof(tests)[0]) 1567 CMFixtureFunction group_setup,
1568 CMFixtureFunction group_teardown);
1570 # define cmocka_run_group_tests(group_tests, group_setup, group_teardown) \ 1571 _cmocka_run_group_tests(#group_tests, group_tests, sizeof(group_tests) / sizeof(group_tests)[0], group_setup, group_teardown) 1635 const struct CMUnitTest group_tests[],
1636 CMFixtureFunction group_setup,
1637 CMFixtureFunction group_teardown);
1639 # define cmocka_run_group_tests_name(group_name, group_tests, group_setup, group_teardown) \ 1640 _cmocka_run_group_tests(group_name, group_tests, sizeof(group_tests) / sizeof(group_tests)[0], group_setup, group_teardown) 1693 #define test_malloc(size) _test_malloc(size, __FILE__, __LINE__) 1712 #define test_calloc(num, size) _test_calloc(num, size, __FILE__, __LINE__) 1728 #define test_realloc(ptr, size) _test_realloc(ptr, size, __FILE__, __LINE__) 1741 #define test_free(ptr) _test_free(ptr, __FILE__, __LINE__) 1746 #define malloc test_malloc 1747 #define realloc test_realloc 1748 #define calloc test_calloc 1749 #define free test_free 1805 void mock_assert(
const int result,
const char*
const expression,
1806 const char *
const file,
const int line);
1833 #define expect_assert_failure(function_call) \ 1835 const int result = setjmp(global_expect_assert_env); \ 1836 global_expecting_assert = 1; \ 1838 print_message("Expected assertion %s occurred\n", \ 1839 global_last_failed_assert); \ 1840 global_expecting_assert = 0; \ 1843 global_expecting_assert = 0; \ 1844 print_error("Expected assert in %s\n", #function_call); \ 1845 _fail(__FILE__, __LINE__); \ 1853 typedef void (*UnitTestFunction)(
void **state);
1860 typedef enum UnitTestFunctionType {
1861 UNIT_TEST_FUNCTION_TYPE_TEST = 0,
1862 UNIT_TEST_FUNCTION_TYPE_SETUP,
1863 UNIT_TEST_FUNCTION_TYPE_TEARDOWN,
1864 UNIT_TEST_FUNCTION_TYPE_GROUP_SETUP,
1865 UNIT_TEST_FUNCTION_TYPE_GROUP_TEARDOWN,
1866 } UnitTestFunctionType;
1873 typedef struct UnitTest {
1875 UnitTestFunction
function;
1876 UnitTestFunctionType function_type;
1879 typedef struct GroupTest {
1880 UnitTestFunction setup;
1881 UnitTestFunction teardown;
1882 const UnitTest *tests;
1883 const size_t number_of_tests;
1887 typedef void (*CMUnitTestFunction)(
void **state);
1890 typedef int (*CMFixtureFunction)(
void **state);
1894 CMUnitTestFunction test_func;
1895 CMFixtureFunction setup_func;
1896 CMFixtureFunction teardown_func;
1900 typedef struct SourceLocation {
1906 typedef struct CheckParameterEvent {
1907 SourceLocation location;
1908 const char *parameter_name;
1909 CheckParameterValue check_value;
1911 } CheckParameterEvent;
1914 extern int global_expecting_assert;
1915 extern jmp_buf global_expect_assert_env;
1916 extern const char * global_last_failed_assert;
1923 const char*
const function,
const char*
const parameter,
1924 const char*
const file,
const int line,
1925 const CheckParameterValue check_function,
1929 void _expect_in_set(
1930 const char*
const function,
const char*
const parameter,
1932 const size_t number_of_values,
const int count);
1933 void _expect_not_in_set(
1934 const char*
const function,
const char*
const parameter,
1936 const size_t number_of_values,
const int count);
1938 void _expect_in_range(
1939 const char*
const function,
const char*
const parameter,
1940 const char*
const file,
const int line,
1943 void _expect_not_in_range(
1944 const char*
const function,
const char*
const parameter,
1945 const char*
const file,
const int line,
1950 const char*
const function,
const char*
const parameter,
1953 void _expect_not_value(
1954 const char*
const function,
const char*
const parameter,
1958 void _expect_string(
1959 const char*
const function,
const char*
const parameter,
1960 const char*
const file,
const int line,
const char*
string,
1962 void _expect_not_string(
1963 const char*
const function,
const char*
const parameter,
1964 const char*
const file,
const int line,
const char*
string,
1967 void _expect_memory(
1968 const char*
const function,
const char*
const parameter,
1969 const char*
const file,
const int line,
const void*
const memory,
1970 const size_t size,
const int count);
1971 void _expect_not_memory(
1972 const char*
const function,
const char*
const parameter,
1973 const char*
const file,
const int line,
const void*
const memory,
1974 const size_t size,
const int count);
1977 const char*
const function,
const char*
const parameter,
1978 const char*
const file,
const int line,
const int count);
1980 void _check_expected(
1981 const char *
const function_name,
const char *
const parameter_name,
1984 void _will_return(
const char *
const function_name,
const char *
const file,
1988 const char*
const expression,
1989 const char *
const file,
const int line);
1993 const char *
const expression,
1994 const char *
const file,
1996 void _assert_int_equal(
1998 const char *
const file,
const int line);
1999 void _assert_int_not_equal(
2001 const char *
const file,
const int line);
2002 void _assert_string_equal(
const char *
const a,
const char *
const b,
2003 const char *
const file,
const int line);
2004 void _assert_string_not_equal(
const char *
const a,
const char *
const b,
2005 const char *file,
const int line);
2006 void _assert_memory_equal(
const void *
const a,
const void *
const b,
2007 const size_t size,
const char*
const file,
2009 void _assert_memory_not_equal(
const void *
const a,
const void *
const b,
2010 const size_t size,
const char*
const file,
2012 void _assert_in_range(
2015 void _assert_not_in_range(
2018 void _assert_in_set(
2020 const size_t number_of_values,
const char*
const file,
const int line);
2021 void _assert_not_in_set(
2023 const size_t number_of_values,
const char*
const file,
const int line);
2025 void* _test_malloc(
const size_t size,
const char* file,
const int line);
2026 void* _test_realloc(
void *ptr,
const size_t size,
const char* file,
const int line);
2027 void* _test_calloc(
const size_t number_of_elements,
const size_t size,
2028 const char* file,
const int line);
2029 void _test_free(
void*
const ptr,
const char* file,
const int line);
2031 void _fail(
const char *
const file,
const int line);
2033 void _skip(
const char *
const file,
const int line);
2036 const char *
const function_name,
const UnitTestFunction Function,
2037 void **
const volatile state,
const UnitTestFunctionType function_type,
2038 const void*
const heap_check_point);
2039 CMOCKA_DEPRECATED
int _run_tests(
const UnitTest *
const tests,
2040 const size_t number_of_tests);
2041 CMOCKA_DEPRECATED
int _run_group_tests(
const UnitTest *
const tests,
2042 const size_t number_of_tests);
2045 int _cmocka_run_group_tests(
const char *group_name,
2046 const struct CMUnitTest *
const tests,
2047 const size_t num_tests,
2048 CMFixtureFunction group_setup,
2049 CMFixtureFunction group_teardown);
2052 void print_message(
const char*
const format, ...) CMOCKA_PRINTF_ATTRIBUTE(1, 2);
2053 void print_error(const
char* const format, ...) CMOCKA_PRINTF_ATTRIBUTE(1, 2);
2054 void vprint_message(const
char* const format, va_list args) CMOCKA_PRINTF_ATTRIBUTE(1, 0);
2055 void vprint_error(const
char* const format, va_list args) CMOCKA_PRINTF_ATTRIBUTE(1, 0);
2057 enum cm_message_output {
void assert_null(void *pointer)
Assert that the given pointer is NULL.
void expect_any_count(#function,#parameter, size_t count)
Add an event to repeatedly check if a parameter (of any value) has been passed.
void fail(void)
Forces the test to fail immediately and quit.
void expect_in_set(#function,#parameter, LargestIntegralType value_array[])
Add an event to check if the parameter value is part of the provided array.
void expect_in_set_count(#function,#parameter, LargestIntegralType value_array[], size_t count)
Add an event to check if the parameter value is part of the provided array.
void will_return_always(#function, LargestIntegralType value)
Store a value that will be always returned by mock().
void assert_memory_not_equal(const void *a, const void *b, size_t size)
Assert that the two given areas of memory are not equal.
void expect_not_in_set_count(#function,#parameter, LargestIntegralType value_array[], size_t count)
Add an event to check if the parameter value is not part of the provided array.
void expect_not_in_range(#function,#parameter, LargestIntegralType minimum, LargestIntegralType maximum)
Add an event to check a parameter is outside a numerical range.
void expect_check(#function,#parameter,#check_function, const void *check_data)
Add a custom parameter checking function.
LargestIntegralType mock(void)
Retrieve a return value of the current function.
void fail_msg(const char *msg,...)
Forces the test to fail immediately and quit, printing the reason.
void assert_in_range(LargestIntegralType value, LargestIntegralType minimum, LargestIntegralType maximum)
Assert that the specified value is not smaller than the minimum and and not greater than the maximum...
void will_return(#function, LargestIntegralType value)
Store a value to be returned by mock() later.
void assert_ptr_equal(void *a, void *b)
Assert that the two given pointers are equal.
void expect_string_count(#function,#parameter, const char *string, size_t count)
Add an event to check if the parameter value is equal to the provided string.
void will_return_count(#function, LargestIntegralType value, int count)
Store a value to be returned by mock() later.
void mock_assert(const int result, const char *const expression, const char *const file, const int line)
Function to replace assert(3) in tested code.
Definition: cmocka.c:1331
int cmocka_run_group_tests(const struct CMUnitTest group_tests[], CMFixtureFunction group_setup, CMFixtureFunction group_teardown)
Run tests specified by an array of CMUnitTest structures.
void expect_any(#function,#parameter)
Add an event to check if a parameter (of any value) has been passed.
void expect_not_in_set(#function,#parameter, LargestIntegralType value_array[])
Add an event to check if the parameter value is not part of the provided array.
void expect_in_range_count(#function,#parameter, LargestIntegralType minimum, LargestIntegralType maximum, size_t count)
Add an event to repeatedly check a parameter is inside a numerical range.
void expect_string(#function,#parameter, const char *string)
Add an event to check if the parameter value is equal to the provided string.
void expect_not_memory(#function,#parameter, void *memory, size_t size)
Add an event to check if the parameter doesn't match an area of memory.
void expect_not_in_range_count(#function,#parameter, LargestIntegralType minimum, LargestIntegralType maximum, size_t count)
Add an event to repeatedly check a parameter is outside a numerical range.
void assert_string_equal(const char *a, const char *b)
Assert that the two given strings are equal.
void * test_malloc(size_t size)
Test function overriding malloc.
void assert_return_code(int rc, int error)
Assert that the return_code is greater than or equal to 0.
void expect_in_range(#function,#parameter, LargestIntegralType minimum, LargestIntegralType maximum)
Add an event to check a parameter is inside a numerical range.
void assert_non_null(void *pointer)
Assert that the given pointer is non-NULL.
void assert_not_in_set(LargestIntegralType value, LargestIntegralType values[], size_t count)
Assert that the specified value is not within a set.
uintmax_t LargestIntegralType
Largest integral type.
Definition: cmocka.h:71
void expect_not_string(#function,#parameter, const char *string)
Add an event to check if the parameter value isn't equal to the provided string.
void assert_true(scalar expression)
Assert that the given expression is true.
void expect_not_string_count(#function,#parameter, const char *string, size_t count)
Add an event to check if the parameter value isn't equal to the provided string.
void assert_string_not_equal(const char *a, const char *b)
Assert that the two given strings are not equal.
void expect_not_value(#function,#parameter, LargestIntegralType value)
Add an event to check if a parameter isn't the given value.
void assert_false(scalar expression)
Assert that the given expression is false.
void check_expected_ptr(#parameter)
Determine whether a function parameter is correct.
type mock_ptr_type(#type)
Retrieve a typed return value of the current function.
int cmocka_run_group_tests_name(const char *group_name, const struct CMUnitTest group_tests[], CMFixtureFunction group_setup, CMFixtureFunction group_teardown)
Run tests specified by an array of CMUnitTest structures and specify a name.
void assert_ptr_not_equal(void *a, void *b)
Assert that the two given pointers are not equal.
void assert_int_not_equal(int a, int b)
Assert that the two given integers are not equal.
void expect_value_count(#function,#parameter, LargestIntegralType value, size_t count)
Add an event to repeatedly check if a parameter is the given value.
int run_test(#function)
Generic method to run a single test.
void skip(void)
Forces the test to not be executed, but marked as skipped.
void cmocka_set_message_output(enum cm_message_output output)
Function to set the output format for a test.
Definition: cmocka.c:2202
void * test_calloc(size_t nmemb, size_t size)
Test function overriding calloc.
void assert_not_in_range(LargestIntegralType value, LargestIntegralType minimum, LargestIntegralType maximum)
Assert that the specified value is smaller than the minimum or greater than the maximum.
void expect_memory(#function,#parameter, void *memory, size_t size)
Add an event to check if the parameter does match an area of memory.
void assert_int_equal(int a, int b)
Assert that the two given integers are equal.
void assert_memory_equal(const void *a, const void *b, size_t size)
Assert that the two given areas of memory are equal, otherwise fail.
void check_expected(#parameter)
Determine whether a function parameter is correct.
void expect_value(#function,#parameter, LargestIntegralType value)
Add an event to check if a parameter is the given value.
void * test_realloc(void *ptr, size_t size)
Test function overriding realloc which detects buffer overruns and memoery leaks. ...
void expect_not_value_count(#function,#parameter, LargestIntegralType value, size_t count)
Add an event to repeatedly check if a parameter isn't the given value.
void test_free(void *ptr)
Test function overriding free(3).
void expect_memory_count(#function,#parameter, void *memory, size_t size, size_t count)
Add an event to repeatedly check if the parameter does match an area of memory.
void expect_assert_failure(function fn_call)
Ensure that mock_assert() is called.
void expect_not_memory_count(#function,#parameter, void *memory, size_t size, size_t count)
Add an event to repeatedly check if the parameter doesn't match an area of memory.
void assert_in_set(LargestIntegralType value, LargestIntegralType values[], size_t count)
Assert that the specified value is within a set.