From bf4ac04c73439395220bb0e6e1b648cb85bb8551 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 1 Oct 2026 10:22:43 +0200 Subject: kstd: ring_buffer: add ctor panic test --- libs/kstd/kstd/ring_buffer.tests.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libs/kstd/kstd/ring_buffer.tests.cpp b/libs/kstd/kstd/ring_buffer.tests.cpp index ae7119ad..d2e4a84d 100644 --- a/libs/kstd/kstd/ring_buffer.tests.cpp +++ b/libs/kstd/kstd/ring_buffer.tests.cpp @@ -141,6 +141,16 @@ SCENARIO("Ring Buffer initialization and construction", "[kstd][ring_buffer]") REQUIRE(buffer.max_size() == buffer.capacity()); } } + + WHEN("constructing by n-copies-of-value constructor using a capacity of 5 and 6 copies") + { + THEN("the constructor panics") + { + REQUIRE_THROWS_MATCHES((kstd::ring_buffer{6, 'a'}), kstd::tests::os_panic, + Catch::Matchers::Message( + "[KSTD] Tried to construct a ring buffer with more elements than it can support.")); + } + } } } -- cgit v1.2.3