whoa/test/util/time/CGameTime.cpp
fallenoak 721ee527eb
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
feat(util): add CGameTime::GameTimeUpdate
2026-01-28 22:01:23 -06:00

60 lines
1.5 KiB
C++

#include "util/time/CGameTime.hpp"
#include "catch.hpp"
TEST_CASE("CGameTime::CGameTime", "[util]") {
SECTION("constructs correctly") {
CGameTime time;
CHECK(time.m_minute == -1);
CHECK(time.m_hour == -1);
CHECK(time.m_weekday == -1);
CHECK(time.m_monthday == -1);
CHECK(time.m_month == -1);
CHECK(time.m_year == -1);
CHECK(time.m_flags == 0x0);
CHECK(time.m_holidayOffset == 0);
}
}
TEST_CASE("CGameTime::GameTimeSetTime", "[util]") {
SECTION("sets game time correctly") {
WowTime time;
time.m_minute = 18;
time.m_hour = 11;
time.m_weekday = 3;
time.m_monthday = 27;
time.m_month = 0;
time.m_year = 26;
CGameTime gameTime;
gameTime.GameTimeSetTime(time, true);
CHECK(gameTime.m_minute == 18);
CHECK(gameTime.m_hour == 11);
CHECK(gameTime.m_weekday == 3);
CHECK(gameTime.m_monthday == 27);
CHECK(gameTime.m_month == 0);
CHECK(gameTime.m_year == 26);
}
}
TEST_CASE("CGameTime::GameTimeUpdate", "[util]") {
SECTION("updates game time correctly") {
WowTime time;
time.m_minute = 18;
time.m_hour = 11;
time.m_weekday = 3;
time.m_monthday = 27;
time.m_month = 0;
time.m_year = 26;
CGameTime gameTime;
gameTime.GameTimeSetTime(time, true);
gameTime.GameTimeUpdate(60.0f);
CHECK(gameTime.m_hour == 11);
CHECK(gameTime.m_minute == 19);
}
}