added more unit tests
All checks were successful
fsfw/fsfw/pipeline/pr-development This commit looks good

This commit is contained in:
Robin Müller 2022-04-01 18:43:46 +02:00
parent 2d0e4ba951
commit b764194ed0
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -22,6 +22,7 @@ TEST_CASE("Power Switcher", "[power-switcher]") {
switcher.turnOn(true);
REQUIRE(mock.getAmountSwitchStatWasRequested() == 1);
REQUIRE(switcher.getState() == PowerSwitcher::WAIT_ON);
REQUIRE(switcher.checkSwitchState() == PowerSwitcher::IN_POWER_TRANSITION);
REQUIRE(switcher.active());
switcher.doStateMachine();
REQUIRE(switcher.getState() == PowerSwitcher::SWITCH_IS_ON);
@ -29,8 +30,10 @@ TEST_CASE("Power Switcher", "[power-switcher]") {
REQUIRE(switchInfo.timesCalledOn == 1);
REQUIRE(not switcher.active());
REQUIRE(mock.getAmountSwitchStatWasRequested() == 2);
REQUIRE(switcher.checkSwitchState() == HasReturnvaluesIF::RETURN_OK);
REQUIRE(mock.getAmountSwitchStatWasRequested() == 3);
switcher.turnOff(false);
REQUIRE(mock.getAmountSwitchStatWasRequested() == 2);
REQUIRE(mock.getAmountSwitchStatWasRequested() == 3);
REQUIRE(switcher.getState() == PowerSwitcher::WAIT_OFF);
REQUIRE(switcher.active());
REQUIRE(switcher.getState() == PowerSwitcher::WAIT_OFF);
@ -40,7 +43,7 @@ TEST_CASE("Power Switcher", "[power-switcher]") {
REQUIRE(switchInfo.timesCalledOn == 1);
REQUIRE(switchInfo.timesCalledOff == 1);
REQUIRE(not switcher.active());
REQUIRE(mock.getAmountSwitchStatWasRequested() == 3);
REQUIRE(mock.getAmountSwitchStatWasRequested() == 4);
}
SECTION("Dummy Test") {
@ -63,4 +66,8 @@ TEST_CASE("Power Switcher", "[power-switcher]") {
REQUIRE(switcherUsingDummy.getState() == PowerSwitcher::SWITCH_IS_OFF);
REQUIRE(not switcherUsingDummy.active());
}
SECTION("More Dummy Tests") {
}
}