extracted the expectations into helper func for ZCD poll function.
This commit is contained in:
parent
d8403a4e82
commit
f10ed49eb4
|
@ -67,6 +67,33 @@ TEST(test_zero_cross_detection, ZCD_IsTriggerdTrueWhenRising)
|
|||
CHECK_TRUE(ZCD_IsTriggered());
|
||||
}
|
||||
|
||||
static void PollIterationExpectations(void)
|
||||
{
|
||||
mock().expectOneCall("ADC_Init")
|
||||
.withUnsignedIntParameter("pin_num", 7);
|
||||
|
||||
mock().expectOneCall("ADC_Enable")
|
||||
.withUnsignedIntParameter("pin_num", 7);
|
||||
|
||||
mock().expectOneCall("ADC_ReadValue_Impl")
|
||||
.withUnsignedIntParameter("pin_num", 7)
|
||||
.ignoreOtherParameters();
|
||||
|
||||
mock().expectOneCall("ADC_Disable");
|
||||
|
||||
mock().expectOneCall("ADC_Init")
|
||||
.withUnsignedIntParameter("pin_num", 7);
|
||||
|
||||
mock().expectOneCall("ADC_Enable")
|
||||
.withUnsignedIntParameter("pin_num", 7);
|
||||
|
||||
mock().expectOneCall("ADC_ReadValue_Impl")
|
||||
.withUnsignedIntParameter("pin_num", 7)
|
||||
.ignoreOtherParameters();
|
||||
|
||||
mock().expectOneCall("ADC_Disable");
|
||||
}
|
||||
|
||||
|
||||
TEST(test_zero_cross_detection, ZCD_PollWorksAfterCalls)
|
||||
{
|
||||
|
@ -77,9 +104,8 @@ TEST(test_zero_cross_detection, ZCD_PollWorksAfterCalls)
|
|||
MockADC_PushValue(50);
|
||||
MockADC_PushValue(50);
|
||||
|
||||
mock().expectNCalls(4, "ADC_ReadValue_Impl")
|
||||
.withUnsignedIntParameter("pin_num", 7)
|
||||
.ignoreOtherParameters();
|
||||
PollIterationExpectations();
|
||||
PollIterationExpectations();
|
||||
|
||||
ZCD_Poll();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue