Enhanced the LibraryTest.filterByTags unit-test

This commit is contained in:
Veloman Yunkan 2021-04-11 00:54:48 +04:00
parent 068f7e5e95
commit 0f277ffa34
1 changed files with 21 additions and 0 deletions

View File

@ -283,6 +283,27 @@ TEST_F(LibraryTest, filterByTags)
})
);
// filtering by tags is case sensitive
bookIds = lib.filter(kiwix::Filter().acceptTags({"stackEXChange"}));
EXPECT_EQ(ids2Titles(bookIds),
TitleCollection({})
);
// filtering by tags requires full match of the search term
bookIds = lib.filter(kiwix::Filter().acceptTags({"stackexch"}));
EXPECT_EQ(ids2Titles(bookIds),
TitleCollection({})
);
// in tags with values (tag:value form) the value is an inseparable
// part of the tag
EXPECT_EQ(ids2Titles(lib.filter(kiwix::Filter().acceptTags({"_category"}))),
TitleCollection({})
);
EXPECT_EQ(ids2Titles(lib.filter(kiwix::Filter().acceptTags({"_category:category_defined_via_tags_only"}))),
TitleCollection({"Tania Louis"})
);
bookIds = lib.filter(kiwix::Filter().acceptTags({"wikipedia"}));
EXPECT_EQ(ids2Titles(bookIds),
TitleCollection({