Files
NazaraEngine/tests/Engine/Core/Clock.cpp
Lynix df8da275c4 Switch from Nz prefix to namespace Nz
What a huge commit


Former-commit-id: 38ac5eebf70adc1180f571f6006192d28fb99897
2015-09-25 19:20:05 +02:00

31 lines
566 B
C++

#include <Nazara/Core/Clock.hpp>
#include <Nazara/Core/Thread.hpp>
#include <Catch/catch.hpp>
SCENARIO("Clock", "[CORE][CLOCK]")
{
GIVEN("A clock paused")
{
Nz::UInt64 initialTime = 1;
Nz::Clock 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")
{
Nz::Thread::Sleep(1);
REQUIRE(clock.GetMicroseconds() != initialTime);
}
}
}
}
}