UnitTests: Add build script and move current tests to "tests/Engine" directory (from "tests/Nazara")
Former-commit-id: 5639305bbdbb69ad6f6f282df6c6de930220b57f
This commit is contained in:
30
tests/Engine/Core/Clock.cpp
Normal file
30
tests/Engine/Core/Clock.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Core/Thread.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
|
||||
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")
|
||||
{
|
||||
NzThread::Sleep(1);
|
||||
REQUIRE(clock.GetMicroseconds() != initialTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user