Crinit -- Configurable Rootfs Init
unit_test.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: MIT
6 #ifndef __UNIT_TEST_H__
7 #define __UNIT_TEST_H__
8 
9 // clang-format off
10 #include <setjmp.h>
11 #include <stdarg.h>
12 #include <stddef.h>
13 #include <stdint.h>
14 #include <cmocka.h>
15 // clang-format on
16 // Rationale: Specific order of includes needed by cmocka.h.
17 
18 #define ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array)))
19 
20 // workaround for cmocka API changes after 1.1.5
21 #ifndef cast_to_largest_integral_type
22 #define cast_to_largest_integral_type(value) cast_to_uintmax_type(value)
23 #endif
24 
34 #define check_expected_dynamic(parameter_string, value) \
35  _check_expected(__func__, parameter_string, __FILE__, __LINE__, cast_to_largest_integral_type(value))
36 
40 #define will_set_parameter(METHOD, PARAM_NAME, VALUE) will_return(METHOD, VALUE)
41 
42 #endif /* __UNIT_TEST_H__ */