Skip to content

Commit

Permalink
ElapsedTime: renamed methods
Browse files Browse the repository at this point in the history
  • Loading branch information
MacDada committed Apr 23, 2023
1 parent c3ac93d commit ad8406f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions lib/DnAppCommon/src/DnApp/Common/ElapsedTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}
Expand Down
24 changes: 12 additions & 12 deletions test/native/DnAppCommon/test_ElapsedTime/ElapsedTimeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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());
}
}

Expand Down

0 comments on commit ad8406f

Please sign in to comment.