Skip to content

Commit

Permalink
Add new DateTimeTest testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
biwiki committed Dec 9, 2024
1 parent bc88d02 commit ef999e5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/units/DateTimeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Windows.h>
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ef999e5

Please sign in to comment.