From ef999e5ac7773508c7d8965dffa5ba7731c8d52d Mon Sep 17 00:00:00 2001 From: biwiki Date: Mon, 9 Dec 2024 21:20:32 +0700 Subject: [PATCH] Add new DateTimeTest testcase --- tests/units/DateTimeTest.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/units/DateTimeTest.cpp b/tests/units/DateTimeTest.cpp index 09340fcc..b62c7c7f 100644 --- a/tests/units/DateTimeTest.cpp +++ b/tests/units/DateTimeTest.cpp @@ -23,6 +23,7 @@ #include "areg/base/NEMath.hpp" #include "areg/base/NEUtilities.hpp" #include "areg/base/String.hpp" +#include "areg/base/Thread.hpp" #ifdef WINDOWS #include @@ -166,6 +167,23 @@ TEST( DateTimeTest, TestNow ) _checkTimeStruct( sysTime, "UTC " ); } +TEST( DateTimeTest, TestOperators) +{ + using namespace std::chrono_literals; + + DateTime dateOld( DateTime::getNow( ) ); + + Thread::sleep( NECommon::WAIT_100_MILLISECONDS ); + + DateTime dateNew( DateTime::getNow( ) ); + + ASSERT_TRUE( dateOld < dateNew); + ASSERT_TRUE( dateOld <= dateNew); + ASSERT_TRUE( dateOld != dateNew); + ASSERT_TRUE( dateNew > dateOld); + ASSERT_TRUE( dateNew >= dateOld); +} + /** * \brief Converts current system time in UTC to local time * by using Win32 API to make sure that the sequence of