mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +08:00
25fa30afc6
Test output now shows the module name left-aligned so you can easily browse to see what modules have what tests and know what module a failing test is coming from.
29 lines
756 B
C++
29 lines
756 B
C++
#include <SFML/System/Clock.hpp>
|
|
#include <SFML/System/Time.hpp>
|
|
|
|
#include <doctest/doctest.h>
|
|
|
|
#include <SystemUtil.hpp>
|
|
#include <thread>
|
|
|
|
TEST_CASE("[System] sf::Clock")
|
|
{
|
|
SUBCASE("getElapsedTime()")
|
|
{
|
|
const sf::Clock clock;
|
|
CHECK(clock.getElapsedTime() >= sf::microseconds(0));
|
|
const auto elapsed = clock.getElapsedTime();
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
|
CHECK(clock.getElapsedTime() > elapsed);
|
|
}
|
|
|
|
SUBCASE("restart()")
|
|
{
|
|
sf::Clock clock;
|
|
CHECK(clock.restart() >= sf::microseconds(0));
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
|
const auto elapsed = clock.restart();
|
|
CHECK(clock.restart() < elapsed);
|
|
}
|
|
}
|