16#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
17#include <doctest/doctest.h>
23 ScopedTimer tas(
"time and sleep");
24 std::this_thread::sleep_for(std::chrono::milliseconds(45));
27TEST_SUITE_BEGIN(
"ScopedTimer");
28TEST_CASE(
"Test the scope dependent timer")
33 ScopedTimer testScopeTimer(
"test scope timer");
35 ScopedTimer localScopeTimer(
"local scope timer");
37 localScopeTimer.substitute(
"second scope timer");
38 std::this_thread::sleep_for(std::chrono::milliseconds(35));
43 for (
int i = 0; i < nint; ++i) {
44 ScopedTimer loop(
"loop timer");
45 std::this_thread::sleep_for(std::chrono::milliseconds(5));
48 for (
int i = 0; i < nint; ++i) {
49 ScopedTimer loop(
"loop timer 2");
53 testScopeTimer.substitute(
"replacement timer");
54 std::this_thread::sleep_for(std::chrono::milliseconds(1));
static Timer & timer()
Returns a reference to the underlying Timer.
static void setTimerAddress(Timer *timer)
void reset()
Deletes all timers except the root, which is reset.
static Timer main
Static timer for general use.