use size instead of capacity on sanity check

This commit is contained in:
Robin Müller 2022-04-11 16:09:15 +02:00
parent c7daf697a8
commit 72e0938f9a
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -16,28 +16,28 @@ void DummyPowerSwitcher::setInitialFusesList(std::vector<ReturnValue_t> fuseList
} }
ReturnValue_t DummyPowerSwitcher::sendSwitchCommand(power::Switch_t switchNr, ReturnValue_t onOff) { ReturnValue_t DummyPowerSwitcher::sendSwitchCommand(power::Switch_t switchNr, ReturnValue_t onOff) {
if (switchNr < switcherList.capacity()) { if (switchNr < switcherList.size()) {
switcherList[switchNr] = onOff; switcherList[switchNr] = onOff;
} }
return RETURN_FAILED; return RETURN_FAILED;
} }
ReturnValue_t DummyPowerSwitcher::sendFuseOnCommand(uint8_t fuseNr) { ReturnValue_t DummyPowerSwitcher::sendFuseOnCommand(uint8_t fuseNr) {
if (fuseNr < fuseList.capacity()) { if (fuseNr < fuseList.size()) {
fuseList[fuseNr] = FUSE_ON; fuseList[fuseNr] = FUSE_ON;
} }
return RETURN_FAILED; return RETURN_FAILED;
} }
ReturnValue_t DummyPowerSwitcher::getSwitchState(power::Switch_t switchNr) const { ReturnValue_t DummyPowerSwitcher::getSwitchState(power::Switch_t switchNr) const {
if (switchNr < switcherList.capacity()) { if (switchNr < switcherList.size()) {
return switcherList[switchNr]; return switcherList[switchNr];
} }
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
ReturnValue_t DummyPowerSwitcher::getFuseState(uint8_t fuseNr) const { ReturnValue_t DummyPowerSwitcher::getFuseState(uint8_t fuseNr) const {
if (fuseNr < fuseList.capacity()) { if (fuseNr < fuseList.size()) {
return fuseList[fuseNr]; return fuseList[fuseNr];
} }
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;