Add a unit test for strip_nonbasic

This commit is contained in:
baldurk
2024-09-06 16:42:11 +01:00
parent bd62fb9a1d
commit 546490c1a6
+22
View File
@@ -346,6 +346,28 @@ TEST_CASE("String manipulation", "[string]")
CHECK(strupper("FOOBAR") == "FOOBAR");
};
SECTION("strip_nonbasic")
{
// not unicode safe, so only testing ASCII characters
for(rdcpair<rdcstr, rdcstr> test : rdcarray<rdcpair<rdcstr, rdcstr>>({
{"", ""},
{"Foobar", "Foobar"},
{"foo123", "foo123"},
{"foo 123", "foo 123"},
{"foo . 123...", "foo . 123..."},
{"foo '' 123", "foo __ 123"},
{"foo -- 123", "foo __ 123"},
{"foo \t\n 123", "foo __ 123"},
{"foo @$.%^&*() 123", "foo __.______ 123"},
}))
{
rdcstr str = test.first;
INFO(str);
strip_nonbasic(str);
CHECK(str == test.second);
}
};
SECTION("split by comma")
{
rdcarray<rdcstr> vec;