10#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
11#include <doctest/doctest.h>
18TEST_SUITE_BEGIN(
"Timer");
19TEST_CASE(
"Test a timer")
23 std::this_thread::sleep_for(std::chrono::milliseconds(20));
25 std::this_thread::sleep_for(std::chrono::milliseconds(15));
28 std::this_thread::sleep_for(std::chrono::milliseconds(35));
30 std::this_thread::sleep_for(std::chrono::milliseconds(11));
33 std::this_thread::sleep_for(std::chrono::milliseconds(11));
37 std::this_thread::sleep_for(std::chrono::milliseconds(1));
39 std::this_thread::sleep_for(std::chrono::milliseconds(11));
44 std::this_thread::sleep_for(std::chrono::milliseconds(20));
47 std::stringstream sout;
49 std::cout << sout.str() << std::endl;
57 std::this_thread::sleep_for(std::chrono::milliseconds(45));
61TEST_CASE(
"Test the scope dependent timer")
67 std::this_thread::sleep_for(std::chrono::milliseconds(35));
73 for (
int i = 0; i < nint; ++i) {
75 std::this_thread::sleep_for(std::chrono::milliseconds(5));
79 for (
int i = 0; i < nint; ++i) {
void tick(const Key &timerName)
Starts a named timer.
void reset()
Deletes all timers except the root, which is reset.
void tock(const Key &timerName)
Stops a named timer.
static Timer main
Static timer for general use.