Skip to content

Commit

Permalink
Fixed stopwatch test
Browse files Browse the repository at this point in the history
  • Loading branch information
SharafMohamed committed Jul 8, 2024
1 parent b84a354 commit ce7f6ee
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions components/core/tests/test-Stopwatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ TEST_CASE("Stopwatch", "[Stopwatch]") {
REQUIRE(time_taken >= 1.0);
REQUIRE(time_taken < 1.1);
}
}

SECTION("Test multiple measurements") {
// Measure some work
stopwatch.start();
sleep(1);
stopwatch.stop();

// Do some other work
sleep(1);

SECTION("Test multiple measurements") {
// Measure some work
stopwatch.start();
sleep(1);
stopwatch.stop();

// Do some other work
sleep(1);

// Measure some work again
stopwatch.start();
sleep(2);
stopwatch.stop();
// Measure some work again
stopwatch.start();
sleep(2);
stopwatch.stop();

double time_taken = stopwatch.get_time_taken_in_seconds();
REQUIRE(time_taken >= 3.0);
REQUIRE(time_taken < 3.1);
double time_taken = stopwatch.get_time_taken_in_seconds();
REQUIRE(time_taken >= 3.0);
REQUIRE(time_taken < 3.1);
}
}

0 comments on commit ce7f6ee

Please sign in to comment.