5 #include "test_ReturnValues.h"
6 #include "test_RecordedArg.h"
9 void (*tearDown)(void);
12 bool Yep=
true, Nope=
false;
14 void DevelopingMock(
bool run_test)
19 setUp = SetUp_AssertCall;
20 tearDown = TearDown_AssertCall;
21 printf(
"\n# Test AssertCall\n");
22 RUN_TEST(AssertCall_returns_false_if_call_number_exceeds_call_list);
23 RUN_TEST(AssertCall_returns_false_if_call_n_does_not_match_name);
24 RUN_TEST(AssertCall_returns_true_if_call_n_matches_name);
26 printf(
"\n# Test AssertArg\n");
27 RUN_TEST(AssertArg_returns_false_if_call_number_exceeds_call_list);
28 RUN_TEST(AssertArg_returns_false_if_arg_number_exceeds_arg_list);
29 RUN_TEST(AssertArg_returns_true_if_arg_1_in_call_1_matches_uint8_arg_value);
30 RUN_TEST(AssertArg_returns_true_if_arg_2_in_call_1_matches_uint8_arg_value);
31 RUN_TEST(AssertArg_returns_true_if_arg_1_in_call_2_matches_uint8_arg_value);
32 RUN_TEST(AssertArg_returns_true_if_arg_2_in_call_2_matches_uint8_arg_value);
34 printf(
"\n# Test NumberOfActualCalls\n");
35 RUN_TEST(NumberOfActualCalls_returns_number_of_actual_calls_recorded_in_mock);
37 setUp = SetUp_libMock;
38 tearDown = TearDown_libMock;
40 printf(
"\n# Test RanAsHoped\n");
41 RUN_TEST(RanAsHoped_returns_true_if_call_lists_match);
42 RUN_TEST(RanAsHoped_returns_false_if_more_expected_calls_than_actual_calls);
43 RUN_TEST(RanAsHoped_returns_false_if_more_actual_calls_than_expected_calls);
44 RUN_TEST(RanAsHoped_returns_false_if_call_names_do_not_match);
45 RUN_TEST(RanAsHoped_returns_false_if_a_call_expected_more_inputs);
46 RUN_TEST(RanAsHoped_returns_false_if_a_call_expected_less_inputs);
47 RUN_TEST(RanAsHoped_returns_false_if_a_call_has_the_wrong_input_value);
49 printf(
"\n# Test WhyDidItFail\n");
54 RUN_TEST(WhyDidItFail_reports_unexpected_calls);
55 RUN_TEST(WhyDidItFail_reports_when_calls_are_out_of_order);
56 RUN_TEST(WhyDidItFail_reports_first_unexpected_call_after_last_expected_call);
57 RUN_TEST(WhyDidItFail_reports_first_missed_call_after_last_actual_call);
61 void DevelopingRecordedCall(
bool run_test)
68 void DevelopingRecordedArg (
bool run_test)
73 setUp = SetUp_RecordedArg; tearDown = TearDown_RecordedArg;
74 printf(
"\n# Test Methods in struct SetupRecord_uint8_t\n");
75 RUN_TEST(SetupRecord_uint8_t_points_pArg_at_a_uint8_t);
76 RUN_TEST(Destroy_for_SetupRecord_uint8_t_frees_a_uint8_t);
77 RUN_TEST(Print_for_SetupRecord_uint8_t_prints_a_uint8_t_to_a_string);
78 RUN_TEST(Match_for_SetupRecord_uint8_t_checks_if_uint8_t_values_match);
79 printf(
"\n# Test Methods in struct SetupRecord_uint16_t\n");
80 RUN_TEST(SetupRecord_uint16_t_points_pArg_at_a_uint16_t);
81 RUN_TEST(Destroy_for_SetupRecord_uint16_t_frees_a_uint16_t);
82 RUN_TEST(Print_for_SetupRecord_uint16_t_prints_a_uint16_t_to_a_string);
83 RUN_TEST(Match_for_SetupRecord_uint16_t_checks_if_uint16_t_values_match);
84 printf(
"\n# Test Methods in struct SetupRecord_GString\n");
85 RUN_TEST(SetupRecord_GString_points_pArg_at_a_GString);
86 RUN_TEST(Destroy_for_SetupRecord_GString_frees_a_GString);
87 RUN_TEST(Print_for_SetupRecord_GString_prints_a_GString_to_a_string);
88 RUN_TEST(Match_for_SetupRecord_GString_checks_if_GString_values_match);
89 printf(
"\n# Test Methods in struct SetupRecord_p_uint8_t\n");
90 RUN_TEST(SetupRecord_p_uint8_t_points_pArg_at_a_pointer_to_an_uint8_t);
91 RUN_TEST(Destroy_for_SetupRecord_p_uint8_t_frees_a_pointer_to_an_uint8_t);
92 RUN_TEST(Print_for_SetupRecord_p_uint8_t_derefs_and_prints_value_to_a_string);
93 RUN_TEST(Match_for_SetupRecord_p_uint8_t_derefs_and_checks_if_values_match);
94 printf(
"\n# Test Methods in struct SetupRecord_p_GString\n");
95 RUN_TEST(SetupRecord_p_GString_points_pArg_at_a_pointer_to_a_GString);
96 RUN_TEST(Destroy_for_SetupRecord_p_GString_frees_a_pointer_to_a_GString);
97 RUN_TEST(Print_for_SetupRecord_p_GString_derefs_and_prints_value_to_a_string);
98 RUN_TEST(Match_for_SetupRecord_p_GString_derefs_and_checks_if_values_match);
102 void DevelopingReturnValues(
bool run_test)
106 setUp = SetUp_ReturnValues; tearDown = TearDown_ReturnValues;
107 printf(
"\n# Test ReturnValues\n");
108 RUN_TEST(StubReturnsFalse_returns_false);
109 RUN_TEST(StubReturnsTrue_returns_true);
110 RUN_TEST(StubReturns_uint8_t_returns_the_input_uint8_t);
118 DevelopingMock (Yep);
119 DevelopingRecordedArg (Yep);
120 DevelopingRecordedCall (Yep);
121 DevelopingReturnValues (Yep);