1 #include "FakeAvr/interrupt.h"
5 #include "HardwareFake.h"
7 static void _SilentAssertCall(uint16_t num,
char const * name)
11 GString *message = g_string_new(NULL);
12 g_string_append_printf(message,
"`%s` is not call %d", name, num);
14 TEST_ASSERT_TRUE_MESSAGE(
15 SilentAssertCall(mock, num, name),
19 g_string_free(message,
true);
21 static void _AssertCall(uint16_t num,
char const * name)
25 GString *message = g_string_new(NULL);
26 g_string_append_printf(message,
"`%s` is not call %d", name, num);
28 TEST_ASSERT_TRUE_MESSAGE(
29 AssertCall(mock, num, name),
33 g_string_free(message,
true);
35 static void _AssertArg(uint16_t call_n, uint8_t arg_n,
void *pval)
75 GString *msg = g_string_new(NULL);
76 g_string_printf(msg,
"Expect different value for call %d arg %d.", call_n, arg_n);
80 TEST_ASSERT_TRUE_MESSAGE(
81 AssertArg(mock, call_n, arg_n, pval),
84 g_string_free(msg,
true);
86 static void _AssertArgByteVal(uint16_t call_n, uint8_t arg_n, uint8_t byte_val) { _AssertArg(call_n, arg_n, &byte_val); }
87 static void _test_call_count_is(uint16_t num)
92 GString *msg = g_string_new(NULL);
94 "Expect call count is %d, but was %d.",
95 num, NumberOfActualCalls(mock)
98 if (num == NumberOfActualCalls(mock)) TEST_PASS();
99 else TEST_FAIL_MESSAGE(msg->str);
101 g_string_free(msg,
true);
See StatusCode.h for context.