Fixed stopwatch test

This commit is contained in:
gabime 2023-12-25 00:18:25 +02:00
parent 68e71cfc49
commit 2a4aa8f2d1

View File

@ -12,7 +12,7 @@ TEST_CASE("stopwatch1", "[stopwatch]") {
std::this_thread::sleep_for(wait_ms); std::this_thread::sleep_for(wait_ms);
auto stop = clock::now(); auto stop = clock::now();
auto diff_ms = std::chrono::duration_cast<milliseconds>(stop - start); auto diff_ms = std::chrono::duration_cast<milliseconds>(stop - start);
REQUIRE(sw.elapsed() >= diff_ms); REQUIRE(sw.elapsed() >= diff_ms - milliseconds(1));
REQUIRE(sw.elapsed() <= diff_ms + tolerance_ms); REQUIRE(sw.elapsed() <= diff_ms + tolerance_ms);
} }