Skip to content

Commit f990346

Browse files
committed
Filter: add startswith/endswith tests
1 parent 0ffd6ff commit f990346

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/unit_tests/filter/filter.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,18 @@ TEST_F(Filter, string_operations) {
397397
EXPECT_EQ(evaluate("\"hello world!\" contains \"\""), true);
398398
EXPECT_EQ(evaluate("not \"\" contains \"hello\""), true);
399399
EXPECT_EQ(evaluate("not \"hello world!\" contains \"foo\""), true);
400+
EXPECT_EQ(evaluate("\"hello world!\" startswith \"hello\""), true);
401+
EXPECT_EQ(evaluate("\"hello world!\" startswith \"hello world!\""), true);
402+
EXPECT_EQ(evaluate("\"hello world!\" startswith \"hello world!!\""), false);
403+
EXPECT_EQ(evaluate("\"hello world!\" startswith \"ello world!!\""), false);
404+
EXPECT_EQ(evaluate("\"hello world!\" startswith \"\""), true);
405+
EXPECT_EQ(evaluate("\"hello world!\" startswith \"ello\""), false);
406+
EXPECT_EQ(evaluate("\"hello world!\" startswith \"world\""), false);
407+
EXPECT_EQ(evaluate("\"hello world!\" endswith \"world\""), false);
408+
EXPECT_EQ(evaluate("\"hello world!\" endswith \"world!\""), true);
409+
EXPECT_EQ(evaluate("\"hello world!\" endswith \"hello world!\""), true);
410+
EXPECT_EQ(evaluate("\"hello world!\" endswith \"hello\""), false);
411+
EXPECT_EQ(evaluate("\"hello world!\" endswith \"hello world!!\""), false);
400412
}
401413

402414
TEST_F(Filter, bitwise_operations) {

0 commit comments

Comments
 (0)