Skip to content

Commit

Permalink
Increase scoped timer intervals in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dudoslav committed Feb 29, 2024
1 parent 76a624a commit 63b582a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/cmake/Superbuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,5 @@ add_custom_target(check
)

add_custom_target(check-ci
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> --test-dir ${CMAKE_CURRENT_BINARY_DIR}/libtiledbvectorsearch --output-on-failure --extra-verbose -E \"unit_slicing|unit_ivf_index|unit_logging\"
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> --test-dir ${CMAKE_CURRENT_BINARY_DIR}/libtiledbvectorsearch --output-on-failure --extra-verbose -E \"unit_slicing|unit_ivf_index\"
)
30 changes: 15 additions & 15 deletions src/include/test/unit_logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ TEST_CASE("logging: test", "[logging]") {
a.stop();

auto f = _timing_data.get_entries_summed("test");
CHECK((f <= 510 && f >= 490));
CHECK((f <= 520 && f >= 500));

a.start();
std::this_thread::sleep_for(500ms);
a.stop();

f = _timing_data.get_entries_summed("test");
CHECK((f <= 1010 && f >= 990));
CHECK((f <= 1040 && f >= 1000));
}

TEST_CASE("logging: noisy test", "[logging]") {
Expand All @@ -70,14 +70,14 @@ TEST_CASE("logging: noisy test", "[logging]") {
a.stop();

auto f = _timing_data.get_entries_summed("noisy_test");
CHECK((f <= 510 && f >= 490));
CHECK((f <= 520 && f >= 500));

a.start();
std::this_thread::sleep_for(500ms);
a.stop();

f = _timing_data.get_entries_summed("noisy_test");
CHECK((f <= 1020 && f >= 980));
CHECK((f <= 1040 && f >= 1000));
}

TEST_CASE("logging: interval test", "[logging]") {
Expand All @@ -88,39 +88,39 @@ TEST_CASE("logging: interval test", "[logging]") {
a.stop();

auto f = _timing_data.get_entries_summed("interval_test");
CHECK((f <= 510 && f >= 490));
CHECK((f <= 520 && f >= 500));
auto g = _timing_data.get_entries_separately("interval_test");
CHECK(g.size() == 1);
CHECK((g[0] <= 510 && g[0] >= 490));
CHECK((g[0] <= 520 && g[0] >= 500));
auto g0 = g[0];

a.start();
std::this_thread::sleep_for(500ms);
a.stop();

f = _timing_data.get_entries_summed("interval_test");
CHECK((f <= 1010 && f >= 990));
CHECK((f <= 1040 && f >= 1000));
g = _timing_data.get_entries_separately("interval_test");
CHECK(g.size() == 2);
CHECK((g[0] <= 510 && g[0] >= 490));
CHECK((g[1] <= 510 && g[1] >= 490));
CHECK((g[0] <= 520 && g[0] >= 500));
CHECK((g[1] <= 520 && g[1] >= 500));
CHECK(g[0] == g0);

f = _timing_data.get_entries_summed("interval_test");
CHECK((f <= 1010 && f >= 990));
CHECK((f <= 1040 && f >= 1000));

std::this_thread::sleep_for(500ms);

f = _timing_data.get_entries_summed("interval_test");
CHECK((f <= 1010 && f >= 990));
CHECK((f <= 1040 && f >= 1000));
g = _timing_data.get_entries_separately("interval_test");
CHECK(g.size() == 2);
CHECK((g[0] <= 510 && g[0] >= 490));
CHECK((g[1] <= 510 && g[1] >= 490));
CHECK((g[0] <= 520 && g[0] >= 500));
CHECK((g[1] <= 520 && g[1] >= 500));
CHECK(g[0] == g0);

f = _timing_data.get_entries_summed("interval_test");
CHECK((f <= 1010 && f >= 990));
CHECK((f <= 1040 && f >= 1000));
}

TEST_CASE("logging: scoped_timer start test", "[logging]") {
Expand All @@ -131,7 +131,7 @@ TEST_CASE("logging: scoped_timer start test", "[logging]") {
TEST_CASE("logging: scoped_timer stop test", "[logging]") {
std::this_thread::sleep_for(500ms);
auto f = _timing_data.get_entries_summed("life_test");
CHECK((f <= 310 && f >= 290));
CHECK((f <= 320 && f >= 300));
}

TEST_CASE("logging: ordering", "[logging]") {
Expand Down

0 comments on commit 63b582a

Please sign in to comment.