Move ComputeTest,GraphicsTest,RenderTest and Std140Debug to the tests folder

Also renamed NazaraUnitTests to UnitTests
This commit is contained in:
SirLynix
2022-12-26 08:44:11 +01:00
parent fe8715f1fb
commit 4b804dc613
71 changed files with 33 additions and 36 deletions

View File

@@ -0,0 +1,51 @@
#include <Nazara/Core/Clock.hpp>
#include <catch2/catch_approx.hpp>
#include <catch2/catch_test_macros.hpp>
#include <chrono>
#include <thread>
SCENARIO("Clock", "[CORE][CLOCK]")
{
GIVEN("A clock paused")
{
Nz::UInt64 initialTime = 100;
Nz::Clock clock(initialTime, true);
WHEN("We get time since it is paused")
{
THEN("Time must be the initialTime")
{
CHECK(clock.GetMicroseconds() == initialTime);
CHECK(clock.IsPaused());
}
}
WHEN("We unpause it")
{
clock.Unpause();
REQUIRE(!clock.IsPaused());
THEN("Time must not be the initialTime")
{
std::this_thread::sleep_for(std::chrono::milliseconds(1));
Nz::UInt64 microSeconds = clock.GetMicroseconds();
CHECK(microSeconds != initialTime);
CHECK(microSeconds / 1000 <= clock.GetMilliseconds());
CHECK(microSeconds / (1000.f * 1000.f) <= clock.GetSeconds());
}
}
WHEN("We restart it")
{
clock.Restart();
THEN("It is unpaused and we can pause it")
{
CHECK(!clock.IsPaused());
clock.Pause();
CHECK(clock.IsPaused());
CHECK(clock.GetMicroseconds() != initialTime);
}
}
}
}