mirror of https://github.com/kiwix/libkiwix.git
Enhanced the LibraryTest.filterByTags unit-test
This commit is contained in:
parent
068f7e5e95
commit
0f277ffa34
|
@ -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"}));
|
bookIds = lib.filter(kiwix::Filter().acceptTags({"wikipedia"}));
|
||||||
EXPECT_EQ(ids2Titles(bookIds),
|
EXPECT_EQ(ids2Titles(bookIds),
|
||||||
TitleCollection({
|
TitleCollection({
|
||||||
|
|
Loading…
Reference in New Issue