Added tests that account for new threshold values.

This commit is contained in:
jakeg00dwin 2024-09-24 09:37:02 -07:00
parent 2200e58002
commit ac94fdc304
1 changed files with 90 additions and 0 deletions

View File

@ -92,5 +92,95 @@ void expect_portb_enabled(uint8_t load_pin)
.withUnsignedIntParameter("bit_num", load_pin);
}
TEST(test_load, PortAHandlerDisabledHigh)
{
MockADC_PushValue(HIGHTHRESH);
setup_adc_expectations(adc_pin);
expect_porta_disabled(load_pin);
Load_HandleLoadPortA(adc_pin, load_pin);
}
TEST(test_load, PortAHandlerDisabledLow)
{
MockADC_PushValue(LOWTHRESH);
setup_adc_expectations(adc_pin);
expect_porta_disabled(load_pin);
Load_HandleLoadPortA(adc_pin, load_pin);
}
TEST(test_load, PortAHandlerEnabledWhenValid)
{
MockADC_PushValue(HIGHTHRESH - 1);
setup_adc_expectations(adc_pin);
expect_porta_enabled(load_pin);
Load_HandleLoadPortA(adc_pin, load_pin);
}
TEST(test_load, PortAHandlerDisblesUntilPowerReset)
{
MockADC_PushValue(HIGHTHRESH - 1);
MockADC_PushValue(HIGHTHRESH);
setup_adc_expectations(adc_pin);
expect_porta_disabled(load_pin);
setup_adc_expectations(adc_pin);
expect_porta_disabled(load_pin);
Load_HandleLoadPortA(adc_pin, load_pin);
Load_HandleLoadPortA(adc_pin, load_pin);
}
TEST(test_load, PortBHandlerDisabledHigh)
{
MockADC_PushValue(HIGHTHRESH);
setup_adc_expectations(adc_pin);
expect_portb_disabled(load_pin);
Load_HandleLoadPortB(adc_pin, load_pin);
}
TEST(test_load, PortBHandlerDisabledLow)
{
MockADC_PushValue(LOWTHRESH);
setup_adc_expectations(adc_pin);
expect_portb_disabled(load_pin);
Load_HandleLoadPortB(adc_pin, load_pin);
}
TEST(test_load, PortBHandlerEnabledWhenValid)
{
MockADC_PushValue(HIGHTHRESH - 1);
setup_adc_expectations(adc_pin);
expect_portb_enabled(load_pin);
Load_HandleLoadPortB(adc_pin, load_pin);
}
TEST(test_load, PortBHandlerDisblesUntilPowerReset)
{
MockADC_PushValue(HIGHTHRESH - 1);
MockADC_PushValue(HIGHTHRESH);
setup_adc_expectations(adc_pin);
expect_portb_disabled(load_pin);
setup_adc_expectations(adc_pin);
expect_portb_disabled(load_pin);
Load_HandleLoadPortB(adc_pin, load_pin);
Load_HandleLoadPortB(adc_pin, load_pin);
}