mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 05:31:07 +03:00
feat(util): add WowTime::SetHourAndMinutes
This commit is contained in:
parent
bfcceed8fd
commit
335bd21a26
@ -164,3 +164,8 @@ int32_t WowTime::GetHourAndMinutes() {
|
||||
|
||||
return this->m_hour * 60 + this->m_minute;
|
||||
}
|
||||
|
||||
void WowTime::SetHourAndMinutes(int32_t minutes) {
|
||||
this->m_hour = minutes / 60;
|
||||
this->m_minute = minutes % 60;
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ class WowTime {
|
||||
|
||||
// Member functions
|
||||
int32_t GetHourAndMinutes();
|
||||
void SetHourAndMinutes(int32_t minutes);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -144,3 +144,13 @@ TEST_CASE("WowTime::GetHourAndMinutes", "[util]") {
|
||||
REQUIRE(time.GetHourAndMinutes() == 11 * 60 + 18);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("WowTime::SetHourAndMinutes", "[util]") {
|
||||
SECTION("sets expected hour and minutes for 11:18") {
|
||||
WowTime time;
|
||||
time.SetHourAndMinutes(11 * 60 + 18);
|
||||
|
||||
CHECK(time.m_hour == 11);
|
||||
CHECK(time.m_minute == 18);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user