From ad8406f8f9e1ecd6a3e815ccfbe8a0913f778122 Mon Sep 17 00:00:00 2001 From: MacDada Date: Sun, 23 Apr 2023 23:51:36 +0200 Subject: [PATCH] ElapsedTime: renamed methods --- .../src/DnApp/Common/ElapsedTime.h | 8 +++---- .../Http/DoorLockController.h | 4 ++-- .../Http/FurnaceController.h | 4 ++-- .../test_ElapsedTime/ElapsedTimeTest.cpp | 24 +++++++++---------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/DnAppCommon/src/DnApp/Common/ElapsedTime.h b/lib/DnAppCommon/src/DnApp/Common/ElapsedTime.h index abc5418..4f73138 100644 --- a/lib/DnAppCommon/src/DnApp/Common/ElapsedTime.h +++ b/lib/DnAppCommon/src/DnApp/Common/ElapsedTime.h @@ -50,22 +50,22 @@ namespace DnApp::Common { } [[nodiscard]] - auto getRemainingMilliseconds() const -> uint16_t { + auto getMillisecondsRemainder() const -> uint16_t { return milliseconds % 1000; } [[nodiscard]] - auto getRemainingSeconds() const -> uint8_t { + auto getSecondsRemainder() const -> uint8_t { return getSeconds() % 60; } [[nodiscard]] - auto getRemainingMinutes() const -> uint8_t { + auto getMinutesRemainder() const -> uint8_t { return getMinutes() % 60; } [[nodiscard]] - auto getRemainingHours() const -> uint8_t { + auto getHoursRemainder() const -> uint8_t { return getHours() % 24; } private: diff --git a/lib/DnWiFiDoorLock/DnWiFiDoorLock/Arduino/Esp8266/EspAsyncWebServer/Http/DoorLockController.h b/lib/DnWiFiDoorLock/DnWiFiDoorLock/Arduino/Esp8266/EspAsyncWebServer/Http/DoorLockController.h index 7aaae10..7d27a04 100644 --- a/lib/DnWiFiDoorLock/DnWiFiDoorLock/Arduino/Esp8266/EspAsyncWebServer/Http/DoorLockController.h +++ b/lib/DnWiFiDoorLock/DnWiFiDoorLock/Arduino/Esp8266/EspAsyncWebServer/Http/DoorLockController.h @@ -69,8 +69,8 @@ namespace DnWiFiDoorLock::Arduino::Esp8266::EspAsyncWebServer::Http { doorLock.isClosed() ? PSTR("🔒") : PSTR("🔓"), doorLock.isClosed() ? PSTR("Zamknięte!") : PSTR("Otwarte!"), uptime.getHours(), - uptime.getRemainingMinutes(), - uptime.getRemainingSeconds() + uptime.getMinutesRemainder(), + uptime.getSecondsRemainder() ).get() ); } diff --git a/lib/DnWiFiDoorLock/DnWiFiDoorLock/Arduino/Esp8266/EspAsyncWebServer/Http/FurnaceController.h b/lib/DnWiFiDoorLock/DnWiFiDoorLock/Arduino/Esp8266/EspAsyncWebServer/Http/FurnaceController.h index 9be58d9..5ff5ac4 100644 --- a/lib/DnWiFiDoorLock/DnWiFiDoorLock/Arduino/Esp8266/EspAsyncWebServer/Http/FurnaceController.h +++ b/lib/DnWiFiDoorLock/DnWiFiDoorLock/Arduino/Esp8266/EspAsyncWebServer/Http/FurnaceController.h @@ -69,8 +69,8 @@ namespace DnWiFiDoorLock::Arduino::Esp8266::EspAsyncWebServer::Http { furnace.isHeaterOn() ? PSTR("🔥") : PSTR("❌"), furnace.isHeaterOn() ? PSTR("włączone!") : PSTR("wyłączone!"), uptime.getHours(), - uptime.getRemainingMinutes(), - uptime.getRemainingSeconds() + uptime.getMinutesRemainder(), + uptime.getSecondsRemainder() ).get() ); } diff --git a/test/native/DnAppCommon/test_ElapsedTime/ElapsedTimeTest.cpp b/test/native/DnAppCommon/test_ElapsedTime/ElapsedTimeTest.cpp index ecc0875..fe8af1e 100644 --- a/test/native/DnAppCommon/test_ElapsedTime/ElapsedTimeTest.cpp +++ b/test/native/DnAppCommon/test_ElapsedTime/ElapsedTimeTest.cpp @@ -14,10 +14,10 @@ namespace { TEST_ASSERT_EQUAL_INT(0, time.getSeconds()); TEST_ASSERT_EQUAL_INT(0, time.getMilliseconds()); - TEST_ASSERT_EQUAL_INT(0, time.getRemainingHours()); - TEST_ASSERT_EQUAL_INT(0, time.getRemainingMinutes()); - TEST_ASSERT_EQUAL_INT(0, time.getRemainingSeconds()); - TEST_ASSERT_EQUAL_INT(0, time.getRemainingMilliseconds()); + TEST_ASSERT_EQUAL_INT(0, time.getHoursRemainder()); + TEST_ASSERT_EQUAL_INT(0, time.getMinutesRemainder()); + TEST_ASSERT_EQUAL_INT(0, time.getSecondsRemainder()); + TEST_ASSERT_EQUAL_INT(0, time.getMillisecondsRemainder()); } auto testTypical() -> void { @@ -30,10 +30,10 @@ namespace { TEST_ASSERT_EQUAL_INT(634567, time.getSeconds()); TEST_ASSERT_EQUAL_INT(634567224, time.getMilliseconds()); - TEST_ASSERT_EQUAL_INT(8, time.getRemainingHours()); - TEST_ASSERT_EQUAL_INT(16, time.getRemainingMinutes()); - TEST_ASSERT_EQUAL_INT(7, time.getRemainingSeconds()); - TEST_ASSERT_EQUAL_INT(224, time.getRemainingMilliseconds()); + TEST_ASSERT_EQUAL_INT(8, time.getHoursRemainder()); + TEST_ASSERT_EQUAL_INT(16, time.getMinutesRemainder()); + TEST_ASSERT_EQUAL_INT(7, time.getSecondsRemainder()); + TEST_ASSERT_EQUAL_INT(224, time.getMillisecondsRemainder()); } auto testMaximal() -> void { @@ -45,10 +45,10 @@ namespace { TEST_ASSERT_EQUAL_INT(4294967, time.getSeconds()); TEST_ASSERT_EQUAL_INT(4294967295, time.getMilliseconds()); - TEST_ASSERT_EQUAL_INT(17, time.getRemainingHours()); - TEST_ASSERT_EQUAL_INT(2, time.getRemainingMinutes()); - TEST_ASSERT_EQUAL_INT(47, time.getRemainingSeconds()); - TEST_ASSERT_EQUAL_INT(295, time.getRemainingMilliseconds()); + TEST_ASSERT_EQUAL_INT(17, time.getHoursRemainder()); + TEST_ASSERT_EQUAL_INT(2, time.getMinutesRemainder()); + TEST_ASSERT_EQUAL_INT(47, time.getSecondsRemainder()); + TEST_ASSERT_EQUAL_INT(295, time.getMillisecondsRemainder()); } }