summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2023-03-24 18:25:10 +0100
committerLinus Groh <mail@linusgroh.de>2023-04-06 23:49:08 +0200
commitd6cf9f53297a8fe2e8455b0502cd458cd42ba12d (patch)
tree27e8b7e6c50fa061d16a405da7c8f01a1b665c7d /Tests
parent3aa485aa09af5dc82aaf96ed24a9aa2796116a26 (diff)
downloadserenity-d6cf9f53297a8fe2e8455b0502cd458cd42ba12d.zip
AK: Add FlyString::is_one_of for variadic string comparison
Diffstat (limited to 'Tests')
-rw-r--r--Tests/AK/TestFlyString.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/Tests/AK/TestFlyString.cpp b/Tests/AK/TestFlyString.cpp
index ff0cd0d5f7..dc182c2b8f 100644
--- a/Tests/AK/TestFlyString.cpp
+++ b/Tests/AK/TestFlyString.cpp
@@ -118,3 +118,19 @@ TEST_CASE(moved_fly_string_becomes_empty)
EXPECT_EQ(fly1, "thisisdefinitelymorethan7bytes"sv);
EXPECT_EQ(FlyString::number_of_fly_strings(), 1u);
}
+
+TEST_CASE(is_one_of)
+{
+ auto foo = MUST(FlyString::from_utf8("foo"sv));
+ auto bar = MUST(FlyString::from_utf8("bar"sv));
+
+ EXPECT(foo.is_one_of(foo));
+ EXPECT(foo.is_one_of(foo, bar));
+ EXPECT(foo.is_one_of(bar, foo));
+ EXPECT(!foo.is_one_of(bar));
+
+ EXPECT(!bar.is_one_of("foo"sv));
+ EXPECT(bar.is_one_of("foo"sv, "bar"sv));
+ EXPECT(bar.is_one_of("bar"sv, "foo"sv));
+ EXPECT(bar.is_one_of("bar"sv));
+}