From 1da7eb55d268814e47f39f31f685d6b4c84c22a3 Mon Sep 17 00:00:00 2001 From: gabime Date: Sun, 8 Dec 2024 23:11:15 +0200 Subject: [PATCH] Added some async tests --- tests/test_async.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_async.cpp b/tests/test_async.cpp index 3ae1a372..a9f2a59f 100644 --- a/tests/test_async.cpp +++ b/tests/test_async.cpp @@ -45,6 +45,9 @@ TEST_CASE("discard policy ", "[async]") { auto [logger, async_sink] = creat_async_logger(queue_size, test_sink); async_sink->set_overflow_policy(async_sink_mt::overflow_policy::overrun_oldest); + REQUIRE(async_sink->get_overflow_policy() == async_sink_mt::overflow_policy::overrun_oldest); + REQUIRE(async_sink->get_discard_counter()==0); + REQUIRE(async_sink->get_overrun_counter()==0); for (size_t i = 0; i < messages; i++) { logger->info("Hello message"); } @@ -55,13 +58,16 @@ TEST_CASE("discard policy ", "[async]") { } TEST_CASE("discard policy discard_new ", "[async]") { - auto test_sink = std::make_shared(); + auto test_sink = std::make_shared(); test_sink->set_delay(std::chrono::milliseconds(1)); size_t queue_size = 4; size_t messages = 1024; auto [logger, async_sink] = creat_async_logger(queue_size, test_sink); async_sink->set_overflow_policy(async_sink_mt::overflow_policy::discard_new); + REQUIRE(async_sink->get_overflow_policy() == async_sink_mt::overflow_policy::discard_new); + REQUIRE(async_sink->get_discard_counter()==0); + REQUIRE(async_sink->get_overrun_counter()==0); for (size_t i = 0; i < messages; i++) { logger->info("Hello message"); }