From ade36e65c6a1026ad9b2dff838622fc439856a57 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 6 Jun 2022 12:30:27 +0200 Subject: [PATCH] missed reply check in simple command nominal test case --- .../devicehandler/TestDeviceHandlerBase.cpp | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp index 5ced746b..dd9e9ca5 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp @@ -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);