First attempt

This commit is contained in:
2026-05-08 17:48:16 +02:00
commit 5e77dc836b
36 changed files with 4806 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
#include <catch2/catch_test_macros.hpp>
#include <kpn/fixed_string.hpp>
using namespace kpn;
TEST_CASE("fixed_string equality", "[fixed_string]") {
constexpr fixed_string a("img");
constexpr fixed_string b("img");
constexpr fixed_string c("sigma");
STATIC_REQUIRE(a == b);
STATIC_REQUIRE(!(a == c));
}
TEST_CASE("fixed_string view", "[fixed_string]") {
constexpr fixed_string s("hello");
REQUIRE(s.view() == "hello");
}
TEST_CASE("index_of hit", "[fixed_string]") {
constexpr auto idx = index_of<fixed_string("b"), fixed_string("a"), fixed_string("b"), fixed_string("c")>();
STATIC_REQUIRE(idx == 1);
}
TEST_CASE("index_of miss returns npos", "[fixed_string]") {
constexpr auto idx = index_of<fixed_string("z"), fixed_string("a"), fixed_string("b")>();
STATIC_REQUIRE(idx == npos);
}