missed reply check in simple command nominal test case

This commit is contained in:
Jakob Meier 2022-06-06 12:30:27 +02:00
parent 103661facc
commit ade36e65c6

View File

@ -32,29 +32,31 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") {
deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ);
deviceHandlerCommander.performOperation();
result = deviceHandlerCommander.getReplyReturnCode();
uint32_t missedReplies = deviceFdirMock.getMissedReplyCount();
REQUIRE(missedReplies == 0);
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
}
// SECTION("Commanding missed reply") {
// comIF.setTestCase(ComIFMock::TestCase::MISSED_REPLY);
// deviceHandlerCommander.resetReplyReturnCode();
// // Set the timeout to 0 to immediately timeout the reply
// deviceHandlerMock.changeSimpleCommandReplyCountdown(0);
// result = deviceHandlerCommander.sendCommand(objects::DEVICE_HANDLER_MOCK,
// DeviceHandlerMock::SIMPLE_COMMAND);
// REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
// deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION);
// deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE);
// deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE);
// deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ);
// deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ);
// deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION);
// deviceHandlerCommander.performOperation();
// result = deviceHandlerCommander.getReplyReturnCode();
// REQUIRE(result == DeviceHandlerIF::TIMEOUT);
// uint32_t missedReplies = deviceFdirMock.getMissedReplyCount();
// REQUIRE(missedReplies == 1);
// }
SECTION("Commanding missed reply") {
comIF.setTestCase(ComIFMock::TestCase::MISSED_REPLY);
deviceHandlerCommander.resetReplyReturnCode();
// Set the timeout to 0 to immediately timeout the reply
deviceHandlerMock.changeSimpleCommandReplyCountdown(0);
result = deviceHandlerCommander.sendCommand(objects::DEVICE_HANDLER_MOCK,
DeviceHandlerMock::SIMPLE_COMMAND);
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION);
deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE);
deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE);
deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ);
deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ);
deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION);
deviceHandlerCommander.performOperation();
result = deviceHandlerCommander.getReplyReturnCode();
REQUIRE(result == DeviceHandlerIF::TIMEOUT);
uint32_t missedReplies = deviceFdirMock.getMissedReplyCount();
REQUIRE(missedReplies == 1);
}
SECTION("Periodic reply nominal") {
comIF.setTestCase(ComIFMock::TestCase::PERIODIC_REPLY_NOMINAL);