From 164c6c342b0718c59310a375024fdfd1fe35357a Mon Sep 17 00:00:00 2001 From: gabime Date: Sun, 8 Dec 2024 23:08:59 +0200 Subject: [PATCH] Added some async tests --- tests/test_async.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_async.cpp b/tests/test_async.cpp index da6cf2b6..3ae1a372 100644 --- a/tests/test_async.cpp +++ b/tests/test_async.cpp @@ -19,9 +19,9 @@ auto creat_async_logger(size_t queue_size, std::shared_ptr backend_sink) { } TEST_CASE("basic async test ", "[async]") { - auto test_sink = std::make_shared(); + const auto test_sink = std::make_shared(); size_t overrun_counter = 0; - size_t queue_size = 16; + const size_t queue_size = 16; size_t messages = 256; { auto [logger, async_sink] = creat_async_logger(queue_size, test_sink); @@ -50,6 +50,8 @@ TEST_CASE("discard policy ", "[async]") { } REQUIRE(test_sink->msg_counter() < messages); REQUIRE(async_sink->get_overrun_counter() > 0); + async_sink->reset_overrun_counter(); + REQUIRE(async_sink->get_overrun_counter() == 0); } TEST_CASE("discard policy discard_new ", "[async]") { @@ -65,6 +67,8 @@ TEST_CASE("discard policy discard_new ", "[async]") { } REQUIRE(test_sink->msg_counter() < messages); REQUIRE(async_sink->get_discard_counter() > 0); + async_sink->reset_discard_counter(); + REQUIRE(async_sink->get_discard_counter() == 0); }