diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-10-01 10:22:43 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-10-01 10:22:43 +0200 |
| commit | bf4ac04c73439395220bb0e6e1b648cb85bb8551 (patch) | |
| tree | d4d044c52e2637d4612600fb1bb99eb9b7d7dc69 | |
| parent | 4b370847c5cb1f81d8bf82644898b71970124828 (diff) | |
| download | kernel-bf4ac04c73439395220bb0e6e1b648cb85bb8551.tar.xz kernel-bf4ac04c73439395220bb0e6e1b648cb85bb8551.zip | |
kstd: ring_buffer: add ctor panic test
| -rw-r--r-- | libs/kstd/kstd/ring_buffer.tests.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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<char, 5>{6, 'a'}), kstd::tests::os_panic, + Catch::Matchers::Message( + "[KSTD] Tried to construct a ring buffer with more elements than it can support.")); + } + } } } |
