Compare commits

..

1 Commits

Author SHA1 Message Date
Gabi Melman
0d5d8140ec Expand ringbuffer sink tests 2025-07-06 00:23:27 +03:00

View File

@@ -15,10 +15,9 @@ TEST_CASE("ringbuffer stores formatted messages", "[ringbuffer]") {
auto formatted = sink.last_formatted(); auto formatted = sink.last_formatted();
REQUIRE(formatted.size() == 3); REQUIRE(formatted.size() == 3);
using spdlog::details::os::default_eol; REQUIRE(formatted[0] == "msg1");
REQUIRE(formatted[0] == spdlog::fmt_lib::format("msg1{}", default_eol)); REQUIRE(formatted[1] == "msg2");
REQUIRE(formatted[1] == spdlog::fmt_lib::format("msg2{}", default_eol)); REQUIRE(formatted[2] == "msg3");
REQUIRE(formatted[2] == spdlog::fmt_lib::format("msg3{}", default_eol));
} }
TEST_CASE("ringbuffer overrun keeps last items", "[ringbuffer]") { TEST_CASE("ringbuffer overrun keeps last items", "[ringbuffer]") {
@@ -31,9 +30,8 @@ TEST_CASE("ringbuffer overrun keeps last items", "[ringbuffer]") {
auto formatted = sink.last_formatted(); auto formatted = sink.last_formatted();
REQUIRE(formatted.size() == 2); REQUIRE(formatted.size() == 2);
using spdlog::details::os::default_eol; REQUIRE(formatted[0] == "second");
REQUIRE(formatted[0] == spdlog::fmt_lib::format("second{}", default_eol)); REQUIRE(formatted[1] == "third");
REQUIRE(formatted[1] == spdlog::fmt_lib::format("third{}", default_eol));
} }
TEST_CASE("ringbuffer retrieval limit", "[ringbuffer]") { TEST_CASE("ringbuffer retrieval limit", "[ringbuffer]") {
@@ -46,8 +44,7 @@ TEST_CASE("ringbuffer retrieval limit", "[ringbuffer]") {
auto formatted = sink.last_formatted(2); auto formatted = sink.last_formatted(2);
REQUIRE(formatted.size() == 2); REQUIRE(formatted.size() == 2);
using spdlog::details::os::default_eol; REQUIRE(formatted[0] == "B");
REQUIRE(formatted[0] == spdlog::fmt_lib::format("B{}", default_eol)); REQUIRE(formatted[1] == "C");
REQUIRE(formatted[1] == spdlog::fmt_lib::format("C{}", default_eol));
} }