Changed the duplicated setup of expectations into the setup and teardown functions.
This commit is contained in:
parent
1761ea38d9
commit
2200e58002
|
@ -23,9 +23,14 @@ extern "C"
|
|||
|
||||
TEST_GROUP(test_load)
|
||||
{
|
||||
uint8_t adc_pin;
|
||||
uint8_t load_pin;
|
||||
void setup()
|
||||
{
|
||||
|
||||
adc_pin = 4;
|
||||
load_pin = 7;
|
||||
MockADC_ZeroIndex();
|
||||
Load_SoftResetDisabledLoads();
|
||||
}
|
||||
void teardown()
|
||||
{
|
||||
|
@ -39,18 +44,53 @@ TEST(test_load, LoadPass)
|
|||
CHECK_TRUE(true);
|
||||
}
|
||||
|
||||
TEST(test_load, PortAHandlerSuccess)
|
||||
void setup_adc_expectations(uint8_t adc_pin)
|
||||
{
|
||||
mock().expectOneCall("ADC_Init")
|
||||
.withUnsignedIntParameter("pin_num", 4);
|
||||
.withUnsignedIntParameter("pin_num", adc_pin);
|
||||
|
||||
mock().expectOneCall("ADC_Enable");
|
||||
mock().expectOneCall("ADC_ReadValue_Impl")
|
||||
.withUnsignedIntParameter("pin_num", 4);
|
||||
.withUnsignedIntParameter("pin_num", adc_pin);
|
||||
mock().expectOneCall("ADC_Disable");
|
||||
}
|
||||
|
||||
void expect_porta_disabled(uint8_t load_pin)
|
||||
{
|
||||
mock().expectOneCall("RegEdit_ClearBit")
|
||||
.withPointerParameter("reg", (void *) &PORTA.OUT)
|
||||
.withUnsignedIntParameter("bit_num", 7);
|
||||
|
||||
Load_HandleLoadPortA(4, 7);
|
||||
.withUnsignedIntParameter("bit_num", load_pin);
|
||||
}
|
||||
|
||||
void expect_porta_enabled(uint8_t load_pin)
|
||||
{
|
||||
mock().expectOneCall("RegEdit_SetBit")
|
||||
.withPointerParameter("reg", (void *) &PORTA.DIR)
|
||||
.withUnsignedIntParameter("bit_num", load_pin);
|
||||
|
||||
mock().expectOneCall("RegEdit_SetBit")
|
||||
.withPointerParameter("reg", (void *) &PORTA.OUT)
|
||||
.withUnsignedIntParameter("bit_num", load_pin);
|
||||
}
|
||||
|
||||
void expect_portb_disabled(uint8_t load_pin)
|
||||
{
|
||||
mock().expectOneCall("RegEdit_ClearBit")
|
||||
.withPointerParameter("reg", (void *) &PORTB.OUT)
|
||||
.withUnsignedIntParameter("bit_num", load_pin);
|
||||
}
|
||||
|
||||
|
||||
void expect_portb_enabled(uint8_t load_pin)
|
||||
{
|
||||
mock().expectOneCall("RegEdit_SetBit")
|
||||
.withPointerParameter("reg", (void *) &PORTB.DIR)
|
||||
.withUnsignedIntParameter("bit_num", load_pin);
|
||||
|
||||
mock().expectOneCall("RegEdit_SetBit")
|
||||
.withPointerParameter("reg", (void *) &PORTB.OUT)
|
||||
.withUnsignedIntParameter("bit_num", load_pin);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue