cmocka 2.0.0
Unit testing library with mock support
Loading...
Searching...
No Matches

Validate function parameters match expected values. More...

Data Structures

struct  SourceLocation
struct  CheckParameterEvent
struct  CheckParameterEventData

Typedefs

typedef int(* CheckParameterValue) (const uintmax_t value, const uintmax_t check_value_data)
typedef int(* CheckParameterValueData) (const CMockaValueData value, const CMockaValueData check_value_data)
typedef int(* CheckIntParameterValue) (const intmax_t value, const intmax_t check_value_data)
typedef int(* CheckUintParameterValue) (const uintmax_t value, const uintmax_t check_value_data)
typedef struct SourceLocation SourceLocation
typedef struct CheckParameterEvent CheckParameterEvent
typedef struct CheckParameterEventData CheckParameterEventData

Functions

void expect_check (function, parameter, CheckParameterValue check_function, const void *check_data)
void expect_check_count (function, parameter, CheckParameterValue check_function, const void *check_data, size_t count)
void expect_check_data (function, parameter, CheckParameterValueData check_function, CMockaValueData check_data)
 Add a custom parameter checking function using CMockaValueData (new API).
void expect_check_data_count (function, parameter, CheckParameterValueData check_function, CMockaValueData check_data, size_t count)
 Add a custom parameter checking function using CMockaValueData with count (new API).
void expect_in_set (#function, #parameter, uintmax_t value_array[])
void expect_in_set (#function, #parameter, intmax_t value_array[])
 Add an event to check if the parameter value is part of the provided integer array.
void expect_in_set_count (#function, #parameter, uintmax_t value_array[], size_t count)
void expect_int_in_set_count (#function, #parameter, intmax_t value_array[], size_t count)
 Add an event to check if the parameter value is part of the provided integer array.
void expect_uint_in_set_count (#function, #parameter, uintmax_t value_array[], size_t count)
 Add an event to check if the parameter value is part of the provided unsigned integer array.
void expect_not_in_set (#function, #parameter, uintmax_t value_array[])
void expect_not_in_set_count (#function, #parameter, uintmax_t value_array[], size_t count)
void expect_int_not_in_set (#function, #parameter, intmax_t value_array[])
 Add an event to check if the integer parameter value is not part of the provided integer array.
void expect_int_not_in_set_count (#function, intmax_t value_array[], size_t count)
 Add an event to check if the integer parameter value is not part of the provided integer array.
void expect_uint_not_in_set (#function, #parameter, uintmax_t value_array[])
 Add an event to check if the unsigned integer parameter value is not part of the provided unsigned integer array.
void expect_uint_not_in_set_count (#function, uintmax_t value_array[], size_t count)
 Add an event to check if the unsigned integer parameter value is not part of the provided unsigned integer array.
void expect_float_in_set (#function, #parameter, double value_array[], double epsilon)
 Add an event to check if the float parameter value is part of the provided array.
void expect_float_in_set_count (#function, #parameter, double value_array[], double epsilon, size_t count)
 Add an event to check if the float parameter value is part of the provided integer array.
void expect_float_not_in_set (#function, #parameter, double value_array[], double epsilon)
 Add an event to check if the float parameter value is not part of the provided array.
void expect_float_not_in_set_count (#function, #parameter, double value_array[], double epsilon, size_t count)
 Add an event to check if the float parameter value is not part of the provided integer array.
void expect_in_range (#function, #parameter, uintmax_t minimum, uintmax_t maximum)
void expect_in_range_count (#function, #parameter, uintmax_t minimum, uintmax_t maximum, size_t count)
void expect_int_in_range (#function, intmax_t minimum, intmax_t maximum)
 Add an event to check an integer parameter is inside a numerical range. The check would succeed if minimum <= value <= maximum.
void expect_int_in_range_count (#function, intmax_t minimum, intmax_t maximum, size_t count)
 Add an event to repeatedly check an integer parameter is inside a numerical range. The check would succeed if minimum <= value <= maximum.
void expect_uint_in_range (#function, uintmax_t minimum, uintmax_t maximum)
 Add an event to check an unsigned integer parameter is inside a numerical range. The check would succeed if minimum <= value <= maximum.
void expect_uint_in_range_count (#function, uintmax_t minimum, uintmax_t maximum, size_t count)
 Add an event to repeatedly check an unsigned integer parameter is inside a numerical range. The check would succeed if minimum <= value <= maximum.
void expect_not_in_range (#function, #parameter, uintmax_t minimum, uintmax_t maximum)
 Add an event to check a parameter is outside a numerical range. The check would succeed if minimum > value > maximum.
void expect_not_in_range_count (#function, #parameter, uintmax_t minimum, uintmax_t maximum, size_t count)
 Add an event to repeatedly check a parameter is outside a numerical range. The check would succeed if minimum > value > maximum.
void expect_int_not_in_range (#function, intmax_t minimum, intmax_t maximum)
 Add an event to check an integer parameter is outside a numerical range. The check would succeed if minimum > value > maximum.
void expect_int_not_in_range_count (#function, intmax_t minimum, intmax_t maximum, size_t count)
 Add an event to repeatedly check an integer parameter is outside a numerical range. The check would succeed if minimum > value > maximum.
void expect_uint_not_in_range (#function, uintmax_t minimum, uintmax_t maximum)
 Add an event to check an unsigned integer parameter is outside a numerical range. The check would succeed if minimum > value > maximum.
void expect_uint_not_in_range_count (#function, uintmax_t minimum, uintmax_t maximum, size_t count)
 Add an event to repeatedly check an unsigned integer parameter is outside a numerical range. The check would succeed if minimum > value > maximum.
void expect_float_in_range (#function, #parameter, double minimum, double maximum, double epsilon)
 Add an event to check a parameter is inside a numerical range. The check would succeed if minimum <= value <= maximum.
void expect_float_in_range_count (#function, #parameter, double minimum, double maximum, double epsilon, size_t count)
 Add an event to repeatedly check a parameter is inside a numerical range. The check would succeed if minimum <= value <= maximum.
void expect_float_not_in_range (#function, #parameter, double minimum, double maximum, double epsilon)
 Add an event to check a parameter is outside a numerical range. The check would succeed if minimum > value > maximum.
void expect_float_not_in_range_count (#function, #parameter, double minimum, double maximum, double epsilon, size_t count)
 Add an event to repeatedly check a parameter is outside a numerical range. The check would succeed if minimum > value > maximum.
void expect_value (#function, #parameter, uintmax_t value)
void expect_value_count (#function, #parameter, uintmax_t value, size_t count)
void expect_int_value (#function, #parameter, intmax_t value)
 Add an event to check if an integer parameter is the given value.
void expect_int_value_count (#function, intmax_t value, size_t count)
 Add an event to repeatedly check if an integer parameter is the given value.
void expect_uint_value (#function, #parameter, uintmax_t value)
 Add an event to check if an unsigned integer parameter is the given value.
void expect_uint_value_count (#function, uintmax_t value, size_t count)
 Add an event to repeatedly check if an unsigned integer parameter is the given value.
void expect_int_not_value (#function, #parameter, intmax_t value)
 Add an event to check if a parameter (int) isn't the given value.
void expect_int_not_value_count (#function, intmax_t value, size_t count)
 Add an event to repeatedly check if a parameter (int) isn't the given value.
void expect_uint_not_value (#function, #parameter, uintmax_t value)
 Add an event to check if a parameter (uint) isn't the given value.
void expect_uint_not_value_count (#function, uintmax_t value, size_t count)
 Add an event to repeatedly check if a parameter (uint) isn't the given value.
void expect_not_value (#function, #parameter, uintmax_t value)
void expect_not_value_count (#function, #parameter, uintmax_t value, size_t count)
void expect_float (#function, #parameter, double value, double epsilon)
 Add an event to check if a parameter is the given floating point value.
void expect_float_count (#function, #parameter, double value, double epsilon, size_t count)
 Add an event to repeatedly check if a parameter is the given floating point value.
void expect_not_float (#function, #parameter, double value, double epsilon)
 Add an event to check if a parameter isn't the given floating point value.
void expect_not_float_count (#function, #parameter, double value, double epsilon, size_t count)
 Add an event to repeatedly check if a parameter isn't the floating point value.
void expect_double (#function, #parameter, double value, double epsilon)
 Add an event to check if a parameter is the given double precision floating point value.
void expect_double_count (#function, double value, double epsilon, size_t count)
 Add an event to repeatedly check if a parameter is the given double precision floating point value.
void expect_not_double (#function, #parameter, double value, double epsilon)
 Add an event to check if a parameter isn't the given double precision floating point value.
void expect_not_double_count (#function, double value, double epsilon, size_t count)
 Add an event to repeatedly check if a parameter isn't the double precision floating point value.
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_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 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 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 expect_memory (#function, #parameter, void *memory, size_t size)
 Add an event to check if the parameter does match an area of memory.
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_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_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 expect_any (#function, #parameter)
 Add an event to check if a parameter (of any value) has been passed.
void expect_any_always (#function, #parameter)
 Add an event to always check if a parameter (of any value) has been passed.
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 check_expected (#parameter)
void check_expected_any (#parameter)
 Check that any parameter value matches the next value in the queue.
void check_expected_ptr (#parameter)
 Determine whether a function parameter is correct.
void check_expected_int (#parameter)
 Determine whether a function parameter is correct.
void check_expected_uint (#parameter)
 Determine whether a function parameter is correct.
void check_expected_float (#parameter)
 Determine whether a function parameter is correct.
void check_expected_double (#parameter)
 Determine whether a function parameter is correct.

Detailed Description

Validate function parameters match expected values.

Functionality to store expected values for mock function parameters.

In addition to storing the return values of mock functions, cmocka provides functionality to store expected values for mock function parameters using the expect_*() functions provided. A mock function parameter can then be validated using the check_expected_*() macros.

Successive calls to expect_*() macros for a parameter queues values to check the specified parameter. check_expected_*() checks a function parameter against the next value queued using expect_*(), if the parameter check fails a test failure is signalled. In addition if check_expected_*() is called and no more parameter values are queued a test failure occurs.

The following test stub illustrates how to do this. First is the the function we call in the test driver:

static void test_driver(void **state)
{
expect_string(chef_cook, order, "hotdog");
}
void expect_string(#function, #parameter, const char *string)
Add an event to check if the parameter value is equal to the provided string.

Now the chef_cook function can check if the parameter we got passed is the parameter which is expected by the test driver. This can be done the following way:

int chef_cook(const char *order, char **dish_out)
{
}
void check_expected_ptr(#parameter)
Determine whether a function parameter is correct.

For a complete example please take a look here

Typedef Documentation

◆ CheckIntParameterValue

typedef int(* CheckIntParameterValue) (const intmax_t value, const intmax_t check_value_data)

Function that determines whether a function parameter value is correct.

◆ CheckParameterEvent

typedef struct CheckParameterEvent CheckParameterEvent

Event that's called to check a parameter value (old API).

◆ CheckParameterEventData

typedef struct CheckParameterEventData CheckParameterEventData

Event that's called to check a parameter value (new API with CMockaValueData).

◆ CheckParameterValue

typedef int(* CheckParameterValue) (const uintmax_t value, const uintmax_t check_value_data)

Function that determines whether a function parameter value is correct (old API).

◆ CheckParameterValueData

typedef int(* CheckParameterValueData) (const CMockaValueData value, const CMockaValueData check_value_data)

Function that determines whether a function parameter value is correct (new API with CMockaValueData).

◆ CheckUintParameterValue

typedef int(* CheckUintParameterValue) (const uintmax_t value, const uintmax_t check_value_data)

Function that determines whether a function parameter value is correct.

◆ SourceLocation

typedef struct SourceLocation SourceLocation

Location within some source code.

Function Documentation

◆ check_expected()

void check_expected ( # parameter)
Deprecated
Use check_expected_int(), check_expected_uint(), check_expected_float or check_expetecd_double() instead.

◆ check_expected_any()

void check_expected_any ( # parameter)

Check that any parameter value matches the next value in the queue.

This generic parameter checker works with any type including structs passed by value. It passes the address of the parameter, making it suitable for struct validation with custom checkers.

Use this when:

  • Checking structs passed by value with expect_check_data()
  • Generic/template code where the type isn't known

For scalar types, prefer the type-specific versions:

Parameters
[in]parameterThe parameter to check.
See also
check_expected_int()
check_expected_uint()
check_expected_float()
check_expected_double()
check_expected_ptr()
expect_check_data()

◆ check_expected_double()

void check_expected_double ( # parameter)

Determine whether a function parameter is correct.

This ensures the next value queued by one of the expect*_double() macros matches the specified variable.

This function needs to be called in the mock object.

Parameters
[in]parameterThe parameter to check.
See also
expect_double
expect_not_double
expect_double_count
expect_not_double_count

◆ check_expected_float()

void check_expected_float ( # parameter)

Determine whether a function parameter is correct.

This ensures the next value queued by one of the expect*_float() macros matches the specified variable.

This function needs to be called in the mock object.

Parameters
[in]parameterThe parameter to check.
See also
expect_float
expect_not_float
expect_float_count
expect_not_float_count

◆ check_expected_int()

void check_expected_int ( # parameter)

Determine whether a function parameter is correct.

This ensures the next value queued by one of the expect_int*() macros matches the specified variable.

This function needs to be called in the mock object.

Parameters
[in]parameterThe parameter to check.

◆ check_expected_ptr()

void check_expected_ptr ( # parameter)

Determine whether a function parameter is correct.

This ensures the next value queued by one of the expect_*() macros matches the specified variable.

This function needs to be called in the mock object.

Parameters
[in]parameterThe pointer to check.

◆ check_expected_uint()

void check_expected_uint ( # parameter)

Determine whether a function parameter is correct.

This ensures the next value queued by one of the expect_uint*() macros matches the specified variable.

This function needs to be called in the mock object.

Parameters
[in]parameterThe parameter to check.

◆ expect_any()

void expect_any ( # function,
# parameter )

Add an event to check if a parameter (of any value) has been passed.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
See also
check_expected().

◆ expect_any_always()

void expect_any_always ( # function,
# parameter )

Add an event to always check if a parameter (of any value) has been passed.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
See also
check_expected().

◆ expect_any_count()

void expect_any_count ( # function,
# parameter,
size_t count )

Add an event to repeatedly check if a parameter (of any value) has been passed.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_check()

void expect_check ( function ,
parameter ,
CheckParameterValue check_function,
const void * check_data )

◆ expect_check_count()

void expect_check_count ( function ,
parameter ,
CheckParameterValue check_function,
const void * check_data,
size_t count )

◆ expect_check_data()

void expect_check_data ( function ,
parameter ,
CheckParameterValueData check_function,
CMockaValueData check_data )

Add a custom parameter checking function using CMockaValueData (new API).

This is the new API that uses CMockaValueData for type-safe parameter checking. It allows checking of integer, float, double, and pointer values.

Parameters
[in]functionThe function to add a custom parameter checking function for.
[in]parameterThe parameters passed to the function.
[in]check_functionThe check function to call (CheckParameterValueData).
[in]check_dataThe data to pass to the check function (CMockaValueData).

Checker Function Interface

The checker function must have the following signature:

int checker_function(CMockaValueData value, CMockaValueData check_data);
Definition cmocka.h:6338

Parameters

Return Value

The checker function should return:

  • Non-zero (typically 1 or true) if the check succeeds
  • Zero (0 or false) if the check fails

When the checker returns zero, cmocka will fail the test with an appropriate error message.

Accessing Values in CMockaValueData

The CMockaValueData union contains the following fields:

  • int_val: For signed integer types (intmax_t)
  • uint_val: For unsigned integer types (uintmax_t)
  • float_val: For single-precision floating-point types (float)
  • real_val: For double-precision floating-point types (double)
  • ptr: For pointer types (const void *)

Usage Notes

  1. Calling will_return() in the checker: You can call will_return() or other cmocka setup functions within your checker function to set up return values dynamically based on the parameter being checked. This is useful when the return value depends on the input parameter.
  2. Checking multiple parameters: To check all parameters of a function at once, you can pass a pointer to a struct containing all parameter values as the check_data. Your checker function can then validate all fields in a single call. See example below.
  3. Memory allocation for check_data: If you allocate memory for the check_data parameter (e.g., for a struct), you are responsible for managing its lifetime. The checker function receives the data by value, so if you pass a pointer in check_data.ptr, ensure it remains valid until the checker is called. Note that cmocka does not free this memory automatically.
// Example: Custom range checker
typedef struct {
int min;
int max;
} range_data;
int check_in_custom_range(CMockaValueData value, CMockaValueData check_data)
{
range_data *range = (range_data *)check_data.ptr;
int val = value.int_val;
// Return 1 (true) if in range, 0 (false) otherwise
return (val >= range->min && val <= range->max);
}
// In your test:
void test_custom_check(void **state)
{
range_data range = {10, 20};
expect_check_data(my_function, param,
check_in_custom_range,
my_function(15); // This will pass
}
// The mocked function:
void my_function(int param)
{
check_expected_int(param); // Triggers the checker
}
void expect_check_data(function, parameter, CheckParameterValueData check_function, CMockaValueData check_data)
Add a custom parameter checking function using CMockaValueData (new API).
void check_expected_int(#parameter)
Determine whether a function parameter is correct.
#define cast_ptr_to_cmocka_value(value)
Definition cmocka.h:156
const void * ptr
Definition cmocka.h:6348
// Example: Checker that also sets return values
int check_and_setup_return(CMockaValueData value, CMockaValueData check_data)
{
int expected = check_data.int_val;
int actual = value.int_val;
if (actual == expected) {
// Set up return value dynamically based on the parameter
will_return_int(some_other_function, actual * 2);
return 1; // Success
}
return 0; // Failure
}
void will_return_int(#function, intmax_t value)
Store an integer value to be returned by mock() later.
intmax_t int_val
Definition cmocka.h:6340
// Example: Checking multiple parameters at once
typedef struct {
int expected_a;
int expected_b;
const char *expected_str;
} multi_param_check;
int check_multiple_params(CMockaValueData value, CMockaValueData check_data)
{
multi_param_check *expected = (multi_param_check *)check_data.ptr;
multi_param_check *actual = (multi_param_check *)value.ptr;
return (actual->expected_a == expected->expected_a &&
actual->expected_b == expected->expected_b &&
strcmp(actual->expected_str, expected->expected_str) == 0);
}
// In your test:
void test_multi_param(void **state)
{
multi_param_check expected = {42, 100, "test"};
multi_param_check actual = {42, 100, "test"};
expect_check_data(my_function, params,
check_multiple_params,
// In the mocked function, you would pack all params into a struct
// and call check_expected_ptr(params)
}
See also
check_expected_int()
check_expected_uint()
check_expected_float()
check_expected_double()
check_expected_ptr()
expect_check_data_count()

◆ expect_check_data_count()

void expect_check_data_count ( function ,
parameter ,
CheckParameterValueData check_function,
CMockaValueData check_data,
size_t count )

Add a custom parameter checking function using CMockaValueData with count (new API).

This is the new API that uses CMockaValueData for type-safe parameter checking. This version allows you to specify how many times the check should be performed.

Parameters
[in]functionThe function to add a custom parameter checking function for.
[in]parameterThe parameters passed to the function.
[in]check_functionThe check function to call (CheckParameterValueData).
[in]check_dataThe data to pass to the check function (CMockaValueData).
[in]countThe number of times this check should be called.
  • A specific positive number: The check will be performed exactly that many times.
  • EXPECT_ALWAYS (-1): The check will always be performed and must be called at least once. The test will fail if not called.
  • EXPECT_MAYBE (-2): The check will always be performed but is not required to be called. The test will not fail if the checker is never invoked.

See expect_check_data() for detailed documentation on the checker function interface, usage notes, and examples.

// Example: Check a parameter exactly 3 times
expect_check_data_count(my_function, param,
my_checker,
3);
my_function(42);
my_function(42);
my_function(42);
void expect_check_data_count(function, parameter, CheckParameterValueData check_function, CMockaValueData check_data, size_t count)
Add a custom parameter checking function using CMockaValueData with count (new API).
#define assign_int_to_cmocka_value(value)
Definition cmocka.h:163
// Example: Always check (must be called at least once)
expect_check_data_count(my_function, param,
my_checker,
my_function(42);
my_function(42);
// Can call any number of times, but at least once
#define EXPECT_ALWAYS
Check a parameter every time when used with expect_check_data_count().
Definition cmocka.h:346
// Example: Optional check (may or may not be called)
expect_check_data_count(my_function, param,
my_checker,
// my_function may or may not be called - test won't fail either way
#define EXPECT_MAYBE
Optionally check a parameter when used with expect_check_data_count().
Definition cmocka.h:357
See also
expect_check_data()

◆ expect_double()

void expect_double ( # function,
# parameter,
double value,
double epsilon )

Add an event to check if a parameter is the given double precision floating point value.

The event is triggered by calling check_expected_double() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value to check.
[in]epsilonThe epsilon used as margin for double comparison.
See also
check_expected_double()

◆ expect_double_count()

void expect_double_count ( # function,
double value,
double epsilon,
size_t count )

Add an event to repeatedly check if a parameter is the given double precision floating point value.

The event is triggered by calling check_expected_double() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value to check.
[in]epsilonThe epsilon used as margin for double comparison.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected_double().

◆ expect_float()

void expect_float ( # function,
# parameter,
double value,
double epsilon )

Add an event to check if a parameter is the given floating point value.

The event is triggered by calling check_expected_float() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value to check.
[in]epsilonThe epsilon used as margin for float comparison.
See also
check_expected_float()
expect_string()
expect_memory()
expect_any()

◆ expect_float_count()

void expect_float_count ( # function,
# parameter,
double value,
double epsilon,
size_t count )

Add an event to repeatedly check if a parameter is the given floating point value.

The event is triggered by calling check_expected_float() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value to check.
[in]epsilonThe epsilon used as margin for float comparison.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected_float().
expect_not_string()
expect_not_memory()

◆ expect_float_in_range()

void expect_float_in_range ( # function,
# parameter,
double minimum,
double maximum,
double epsilon )

Add an event to check a parameter is inside a numerical range. The check would succeed if minimum <= value <= maximum.

The event is triggered by calling check_expected_float() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
[in]epsilonThe epsilon used as margin for float comparison.
See also
check_expected_float().

◆ expect_float_in_range_count()

void expect_float_in_range_count ( # function,
# parameter,
double minimum,
double maximum,
double epsilon,
size_t count )

Add an event to repeatedly check a parameter is inside a numerical range. The check would succeed if minimum <= value <= maximum.

The event is triggered by calling check_expected_float() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
[in]epsilonThe epsilon used as margin for float comparison.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected_float()

◆ expect_float_in_set()

void expect_float_in_set ( # function,
# parameter,
double value_array[],
double epsilon )

Add an event to check if the float parameter value is part of the provided array.

The event is triggered by calling check_expected_float() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]epsilonThe epsilon used as margin for float comparison.
[in]value_array[]The array to check for the value.
See also
check_expected_float().

◆ expect_float_in_set_count()

void expect_float_in_set_count ( # function,
# parameter,
double value_array[],
double epsilon,
size_t count )

Add an event to check if the float parameter value is part of the provided integer array.

The event is triggered by calling check_expected_float() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]value_array[]The array to check for the value.
[in]epsilonThe epsilon used as margin for float comparison.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected_float().

◆ expect_float_not_in_range()

void expect_float_not_in_range ( # function,
# parameter,
double minimum,
double maximum,
double epsilon )

Add an event to check a parameter is outside a numerical range. The check would succeed if minimum > value > maximum.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
[in]epsilonThe epsilon used as margin for float comparison.
See also
check_expected().

◆ expect_float_not_in_range_count()

void expect_float_not_in_range_count ( # function,
# parameter,
double minimum,
double maximum,
double epsilon,
size_t count )

Add an event to repeatedly check a parameter is outside a numerical range. The check would succeed if minimum > value > maximum.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
[in]epsilonThe epsilon used as margin for float comparison.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_float_not_in_set()

void expect_float_not_in_set ( # function,
# parameter,
double value_array[],
double epsilon )

Add an event to check if the float parameter value is not part of the provided array.

The event is triggered by calling check_expected_float() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]epsilonThe epsilon used as margin for float comparison.
[in]value_array[]The array to check for the value.
See also
check_expected_float().

◆ expect_float_not_in_set_count()

void expect_float_not_in_set_count ( # function,
# parameter,
double value_array[],
double epsilon,
size_t count )

Add an event to check if the float parameter value is not part of the provided integer array.

The event is triggered by calling check_expected_float() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]value_array[]The array to check for the value.
[in]epsilonThe epsilon used as margin for float comparison.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected_float().

◆ expect_in_range()

void expect_in_range ( # function,
# parameter,
uintmax_t minimum,
uintmax_t maximum )

◆ expect_in_range_count()

void expect_in_range_count ( # function,
# parameter,
uintmax_t minimum,
uintmax_t maximum,
size_t count )

◆ expect_in_set() [1/2]

void expect_in_set ( # function,
# parameter,
intmax_t value_array[] )

Add an event to check if the parameter value is part of the provided integer array.

Add an event to check if the parameter value is part of the provided unsigned integer array.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]value_array[]The array to check for the value.
See also
check_expected().

◆ expect_in_set() [2/2]

void expect_in_set ( # function,
# parameter,
uintmax_t value_array[] )
Deprecated
Use expect_int_in_set() or expect_uint_in_set()

◆ expect_in_set_count()

void expect_in_set_count ( # function,
# parameter,
uintmax_t value_array[],
size_t count )

◆ expect_int_in_range()

void expect_int_in_range ( # function,
intmax_t minimum,
intmax_t maximum )

Add an event to check an integer parameter is inside a numerical range. The check would succeed if minimum <= value <= maximum.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
See also
check_expected().

◆ expect_int_in_range_count()

void expect_int_in_range_count ( # function,
intmax_t minimum,
intmax_t maximum,
size_t count )

Add an event to repeatedly check an integer parameter is inside a numerical range. The check would succeed if minimum <= value <= maximum.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_int_in_set_count()

void expect_int_in_set_count ( # function,
# parameter,
intmax_t value_array[],
size_t count )

Add an event to check if the parameter value is part of the provided integer array.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]value_array[]The array to check for the value.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_int_not_in_range()

void expect_int_not_in_range ( # function,
intmax_t minimum,
intmax_t maximum )

Add an event to check an integer parameter is outside a numerical range. The check would succeed if minimum > value > maximum.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
See also
check_expected().

◆ expect_int_not_in_range_count()

void expect_int_not_in_range_count ( # function,
intmax_t minimum,
intmax_t maximum,
size_t count )

Add an event to repeatedly check an integer parameter is outside a numerical range. The check would succeed if minimum > value > maximum.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_int_not_in_set()

void expect_int_not_in_set ( # function,
# parameter,
intmax_t value_array[] )

Add an event to check if the integer parameter value is not part of the provided integer array.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]value_array[]The array to check for the value.
See also
check_expected().

◆ expect_int_not_in_set_count()

void expect_int_not_in_set_count ( # function,
intmax_t value_array[],
size_t count )

Add an event to check if the integer parameter value is not part of the provided integer array.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]value_array[]The array to check for the value.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_int_not_value()

void expect_int_not_value ( # function,
# parameter,
intmax_t value )

Add an event to check if a parameter (int) isn't the given value.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value (intmax_t) to check.
See also
check_expected().

◆ expect_int_not_value_count()

void expect_int_not_value_count ( # function,
intmax_t value,
size_t count )

Add an event to repeatedly check if a parameter (int) isn't the given value.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value (intmax_t) to check.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_int_value()

void expect_int_value ( # function,
# parameter,
intmax_t value )

Add an event to check if an integer parameter is the given value.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value to check.
See also
check_expected().

◆ expect_int_value_count()

void expect_int_value_count ( # function,
intmax_t value,
size_t count )

Add an event to repeatedly check if an integer parameter is the given value.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value to check.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_memory()

void expect_memory ( # function,
# parameter,
void * memory,
size_t size )

Add an event to check if the parameter does match an area of memory.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]memoryThe memory to compare.
[in]sizeThe size of the memory to compare.
See also
check_expected().

◆ expect_memory_count()

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.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]memoryThe memory to compare.
[in]sizeThe size of the memory to compare.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_not_double()

void expect_not_double ( # function,
# parameter,
double value,
double epsilon )

Add an event to check if a parameter isn't the given double precision floating point value.

The event is triggered by calling check_expected_double() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value to check.
[in]epsilonThe epsilon used as margin for double comparison.
See also
check_expected_double()

◆ expect_not_double_count()

void expect_not_double_count ( # function,
double value,
double epsilon,
size_t count )

Add an event to repeatedly check if a parameter isn't the double precision floating point value.

The event is triggered by calling check_expected_double() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value to check.
[in]epsilonThe epsilon used as margin for double comparison.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected_double().

◆ expect_not_float()

void expect_not_float ( # function,
# parameter,
double value,
double epsilon )

Add an event to check if a parameter isn't the given floating point value.

The event is triggered by calling check_expected_float() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value to check.
[in]epsilonThe epsilon used as margin for float comparison.
See also
check_expected_float()
expect_string()
expect_memory()
expect_any()

◆ expect_not_float_count()

void expect_not_float_count ( # function,
# parameter,
double value,
double epsilon,
size_t count )

Add an event to repeatedly check if a parameter isn't the floating point value.

The event is triggered by calling check_expected_float() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value to check.
[in]epsilonThe epsilon used as margin for float comparison.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected_float().
expect_not_string()
expect_not_memory()

◆ expect_not_in_range()

void expect_not_in_range ( # function,
# parameter,
uintmax_t minimum,
uintmax_t maximum )

Add an event to check a parameter is outside a numerical range. The check would succeed if minimum > value > maximum.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
See also
check_expected().

◆ expect_not_in_range_count()

void expect_not_in_range_count ( # function,
# parameter,
uintmax_t minimum,
uintmax_t maximum,
size_t count )

Add an event to repeatedly check a parameter is outside a numerical range. The check would succeed if minimum > value > maximum.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_not_in_set()

void expect_not_in_set ( # function,
# parameter,
uintmax_t value_array[] )

◆ expect_not_in_set_count()

void expect_not_in_set_count ( # function,
# parameter,
uintmax_t value_array[],
size_t count )

◆ expect_not_memory()

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.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]memoryThe memory to compare.
[in]sizeThe size of the memory to compare.
See also
check_expected().

◆ expect_not_memory_count()

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.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]memoryThe memory to compare.
[in]sizeThe size of the memory to compare.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_not_string()

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.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]stringThe string value to compare.
See also
check_expected().

◆ expect_not_string_count()

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.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]stringThe string value to compare.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_not_value()

void expect_not_value ( # function,
# parameter,
uintmax_t value )

◆ expect_not_value_count()

void expect_not_value_count ( # function,
# parameter,
uintmax_t value,
size_t count )

◆ expect_string()

void expect_string ( # function,
# parameter,
const char * string )

Add an event to check if the parameter value is equal to the provided string.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]stringThe string value to compare.
See also
check_expected().

◆ expect_string_count()

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.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]stringThe string value to compare.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_uint_in_range()

void expect_uint_in_range ( # function,
uintmax_t minimum,
uintmax_t maximum )

Add an event to check an unsigned integer parameter is inside a numerical range. The check would succeed if minimum <= value <= maximum.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
See also
check_expected().

◆ expect_uint_in_range_count()

void expect_uint_in_range_count ( # function,
uintmax_t minimum,
uintmax_t maximum,
size_t count )

Add an event to repeatedly check an unsigned integer parameter is inside a numerical range. The check would succeed if minimum <= value <= maximum.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_uint_in_set_count()

void expect_uint_in_set_count ( # function,
# parameter,
uintmax_t value_array[],
size_t count )

Add an event to check if the parameter value is part of the provided unsigned integer array.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]value_array[]The array to check for the value.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_uint_not_in_range()

void expect_uint_not_in_range ( # function,
uintmax_t minimum,
uintmax_t maximum )

Add an event to check an unsigned integer parameter is outside a numerical range. The check would succeed if minimum > value > maximum.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
See also
check_expected().

◆ expect_uint_not_in_range_count()

void expect_uint_not_in_range_count ( # function,
uintmax_t minimum,
uintmax_t maximum,
size_t count )

Add an event to repeatedly check an unsigned integer parameter is outside a numerical range. The check would succeed if minimum > value > maximum.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]minimumThe lower boundary of the interval to check against.
[in]maximumThe upper boundary of the interval to check against.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_uint_not_in_set()

void expect_uint_not_in_set ( # function,
# parameter,
uintmax_t value_array[] )

Add an event to check if the unsigned integer parameter value is not part of the provided unsigned integer array.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]value_array[]The array to check for the value.
See also
check_expected().

◆ expect_uint_not_in_set_count()

void expect_uint_not_in_set_count ( # function,
uintmax_t value_array[],
size_t count )

Add an event to check if the unsigned integer parameter value is not part of the provided unsigned integer array.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]value_array[]The array to check for the value.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_uint_not_value()

void expect_uint_not_value ( # function,
# parameter,
uintmax_t value )

Add an event to check if a parameter (uint) isn't the given value.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value (uintmax_t) to check.
See also
check_expected().

◆ expect_uint_not_value_count()

void expect_uint_not_value_count ( # function,
uintmax_t value,
size_t count )

Add an event to repeatedly check if a parameter (uint) isn't the given value.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value (uintmax_t) to check.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_uint_value()

void expect_uint_value ( # function,
# parameter,
uintmax_t value )

Add an event to check if an unsigned integer parameter is the given value.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value to check.
See also
check_expected().

◆ expect_uint_value_count()

void expect_uint_value_count ( # function,
uintmax_t value,
size_t count )

Add an event to repeatedly check if an unsigned integer parameter is the given value.

The event is triggered by calling check_expected() in the mocked function.

Parameters
[in]functionThe function to add the check for.
[in]parameterThe name of the parameter passed to the function.
[in]valueThe value to check.
[in]countThe count parameter returns the number of times the value should be returned by check_expected(). If count is set to -1 the value will always be returned.
See also
check_expected().

◆ expect_value()

void expect_value ( # function,
# parameter,
uintmax_t value )

◆ expect_value_count()

void expect_value_count ( # function,
# parameter,
uintmax_t value,
size_t count )