From 1c17aac544b4abfa069be3b1225f87ea3ee14ad9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 28 Feb 2022 20:27:24 +0100 Subject: [PATCH] added last unittests --- unittest/rebootLogic/main.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/unittest/rebootLogic/main.cpp b/unittest/rebootLogic/main.cpp index 817bffe6..9d6ef218 100644 --- a/unittest/rebootLogic/main.cpp +++ b/unittest/rebootLogic/main.cpp @@ -232,6 +232,24 @@ TEST_CASE( "Core Controller Reboot File Handling", "[reboot-file]" ) { // Should be on 0 0 now CHECK(CoreController::CURRENT_CHIP == xsc::CHIP_0); CHECK(CoreController::CURRENT_COPY == xsc::COPY_0); + ctrl.performRebootFileHandling(false); + ctrl.parseRebootFile(REBOOT_FILE, rf); + REQUIRE(rf.enabled == 1); + REQUIRE(rf.img00Cnt == 1); + REQUIRE(rf.img01Cnt == 0); + REQUIRE(rf.img10Cnt == 5); + REQUIRE(rf.img11Cnt == 3); + + // Now reset all reboot counters manually + ctrl.executeAction(CoreController::RESET_REBOOT_COUNTER_00, 0, nullptr, 0); + ctrl.executeAction(CoreController::RESET_REBOOT_COUNTER_10, 0, nullptr, 0); + ctrl.executeAction(CoreController::RESET_REBOOT_COUNTER_11, 0, nullptr, 0); + ctrl.parseRebootFile(REBOOT_FILE, rf); + REQUIRE(rf.enabled == 1); + REQUIRE(rf.img00Cnt == 0); + REQUIRE(rf.img01Cnt == 0); + REQUIRE(rf.img10Cnt == 0); + REQUIRE(rf.img11Cnt == 0); } if(std::filesystem::exists(CONF_PATH)) { std::uintmax_t n = std::filesystem::remove_all(CONF_PATH);