Files
NazaraEngine/tests/Nazara/Core/Clock.cpp
Gawaboumga f61aa8f36e Include Catch and tests for Core
Catch 1.2.1


Former-commit-id: 4149eaa61b21532d4d204db8a3771c6de8e4672c
2015-08-21 11:46:46 +02:00

32 lines
579 B
C++

#include <Nazara/Core/Clock.hpp>
#include <catch.hpp>
#include <thread>
SCENARIO("Clock", "[CORE][CLOCK]")
{
GIVEN("A clock paused")
{
nzUInt64 initialTime = 1;
NzClock clock(initialTime, true);
WHEN("We get time")
{
THEN("Time must be the initialTime")
{
REQUIRE(clock.GetMicroseconds() == initialTime);
}
AND_WHEN("We unpause it")
{
clock.Unpause();
THEN("Time must not be the initialTime")
{
std::this_thread::sleep_for(std::chrono::microseconds(10));
REQUIRE(clock.GetMicroseconds() != initialTime);
}
}
}
}
}