generated from TDD-Templates/cmake_cpputest_template_avr
Added test for the ADC reading timeout feature
This commit is contained in:
parent
fc3d0d11a5
commit
58ab3c12eb
|
@ -140,13 +140,32 @@ TEST(test_ADC, ADC_DisablePasses)
|
|||
ADC_Disable();
|
||||
}
|
||||
|
||||
TEST(test_ADC, ADC_ReadValueImplimentationTimesOut)
|
||||
{
|
||||
//Expect the start conversion bit to be set.
|
||||
mock().expectOneCall("RegEdit_SetBit")
|
||||
.withPointerParameter("reg", (void *) &ADCSRA)
|
||||
.withUnsignedIntParameter("bit_num", ADSC);
|
||||
|
||||
//Check that it can time out.
|
||||
|
||||
//Expect it to read the start bit
|
||||
mock().expectNCalls(ADC_WAIT_TIMEOUT, "RegEdit_IsBitSet")
|
||||
.withPointerParameter("reg", (void *) &ADCSRA)
|
||||
.withUnsignedIntParameter("bit_num", ADSC);
|
||||
|
||||
//Check that it does return a value.
|
||||
|
||||
ADC_ReadValue(0);
|
||||
}
|
||||
|
||||
|
||||
static uint16_t ADC_ReadValueFake(uint8_t pin_num)
|
||||
{
|
||||
return 512;
|
||||
}
|
||||
|
||||
TEST_GROUP(test_ADCRead)
|
||||
TEST_GROUP(test_ADCReadPtrSwap)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
|
@ -159,7 +178,7 @@ TEST_GROUP(test_ADCRead)
|
|||
}
|
||||
};
|
||||
|
||||
TEST(test_ADCRead, FunctionPointerSwapWorks)
|
||||
TEST(test_ADCReadPtrSwap, FunctionPointerSwapWorks)
|
||||
{
|
||||
uint16_t value = ADC_ReadValue(0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue