From 0f277ffa34981814f4f8dab0cfafea0bf8f2ffdc Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Sun, 11 Apr 2021 00:54:48 +0400 Subject: [PATCH] Enhanced the LibraryTest.filterByTags unit-test --- test/library.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/library.cpp b/test/library.cpp index f7b9b385c..55be4931c 100644 --- a/test/library.cpp +++ b/test/library.cpp @@ -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({