Include Catch and tests for Core
Catch 1.2.1 Former-commit-id: 4149eaa61b21532d4d204db8a3771c6de8e4672c
This commit is contained in:
31
tests/Nazara/Core/Clock.cpp
Normal file
31
tests/Nazara/Core/Clock.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user