First attempt
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user