Made tests for reading state function more comperhensive.

This commit is contained in:
jakeg00dwin 2024-09-01 13:37:13 -07:00
parent 9c878f9e08
commit 307ae22aa8
1 changed files with 24 additions and 0 deletions

View File

@ -48,6 +48,11 @@ TEST(test_Relays, CreateRelayStruct)
CHECK(relay.input_port == &fake_input_port);
}
TEST(test_Relays, MeasureMakeTimeForRelay)
{
FAIL_TEST("Not currently ready for testing.");
}
TEST(test_Relays, DisabledForPowerCycleSetsDisabledBit)
{
Relay_DisableForPowerCycle(&relay);
@ -92,4 +97,23 @@ TEST(test_Relays, DisableDoesNothingOnPCDisabledRelay)
CHECK_EQUAL(0xFF, *(uint8_t *)relay.output_port);
}
TEST(test_Relays, ReadStateOfUinitializedReadsFalse)
{
for(uint8_t i = 0; i <= 7; i++){
zero_relay_struct(&relay);
relay.input_pin = i;
CHECK_FALSE(Relay_ReadState(&relay));
}
}
TEST(test_Relays, ReadStateOfEnabledRelayReadsTrue)
{
for(uint8_t i = 0; i <= 7; i++){
zero_relay_struct(&relay);
relay.input_pin = i;
Relay_Enable(&relay);
CHECK_TRUE(Relay_ReadState(&relay));
}
}