cleaned up tests a bit more by extracting duplication in helper function
This commit is contained in:
parent
a061258669
commit
1a5324aef6
|
@ -33,13 +33,18 @@ TEST_GROUP(test_zero_cross_detection)
|
|||
};
|
||||
|
||||
|
||||
static void PollIterationExpectations(void)
|
||||
static void ZCDSetupExpectations(void)
|
||||
{
|
||||
mock().expectOneCall("ADC_Init")
|
||||
.withUnsignedIntParameter("pin_num", 7);
|
||||
|
||||
mock().expectOneCall("ADC_Enable")
|
||||
.withUnsignedIntParameter("pin_num", 7);
|
||||
}
|
||||
|
||||
static void PollIterationExpectations(void)
|
||||
{
|
||||
ZCDSetupExpectations();
|
||||
|
||||
mock().expectOneCall("ADC_ReadValue_Impl")
|
||||
.withUnsignedIntParameter("pin_num", 7)
|
||||
|
@ -47,11 +52,7 @@ static void PollIterationExpectations(void)
|
|||
|
||||
mock().expectOneCall("ADC_Disable");
|
||||
|
||||
mock().expectOneCall("ADC_Init")
|
||||
.withUnsignedIntParameter("pin_num", 7);
|
||||
|
||||
mock().expectOneCall("ADC_Enable")
|
||||
.withUnsignedIntParameter("pin_num", 7);
|
||||
ZCDSetupExpectations();
|
||||
|
||||
mock().expectOneCall("ADC_ReadValue_Impl")
|
||||
.withUnsignedIntParameter("pin_num", 7)
|
||||
|
@ -63,11 +64,7 @@ static void PollIterationExpectations(void)
|
|||
|
||||
TEST(test_zero_cross_detection, ZCD_SetupCallsCorrectFuncs)
|
||||
{
|
||||
mock().expectOneCall("ADC_Init")
|
||||
.withUnsignedIntParameter("pin_num", 7);
|
||||
|
||||
mock().expectOneCall("ADC_Enable")
|
||||
.withUnsignedIntParameter("pin_num", 7);
|
||||
ZCDSetupExpectations();
|
||||
|
||||
ZCD_Setup();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue