mirror of https://github.com/kiwix/libkiwix.git
Split LibraryTest.filterCheck into several tests
This commit is contained in:
parent
db3e0d7f72
commit
8c18a37961
|
@ -252,12 +252,15 @@ TEST_F(LibraryTest, categoryHandling)
|
||||||
EXPECT_EQ("category_element_overrides_tags", lib.getBookById("14829621-c490-c376-0792-9de558b57efa").getCategory());
|
EXPECT_EQ("category_element_overrides_tags", lib.getBookById("14829621-c490-c376-0792-9de558b57efa").getCategory());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(LibraryTest, filterCheck)
|
TEST_F(LibraryTest, emptyFilter)
|
||||||
{
|
{
|
||||||
auto bookIds = lib.filter(kiwix::Filter());
|
const auto bookIds = lib.filter(kiwix::Filter());
|
||||||
EXPECT_EQ(bookIds, lib.getBooksIds());
|
EXPECT_EQ(bookIds, lib.getBooksIds());
|
||||||
|
}
|
||||||
|
|
||||||
bookIds = lib.filter(kiwix::Filter().lang("eng"));
|
TEST_F(LibraryTest, filterByLanguage)
|
||||||
|
{
|
||||||
|
const auto bookIds = lib.filter(kiwix::Filter().lang("eng"));
|
||||||
EXPECT_EQ(ids2Titles(bookIds),
|
EXPECT_EQ(ids2Titles(bookIds),
|
||||||
TitleCollection({
|
TitleCollection({
|
||||||
"Granblue Fantasy Wiki",
|
"Granblue Fantasy Wiki",
|
||||||
|
@ -267,8 +270,11 @@ TEST_F(LibraryTest, filterCheck)
|
||||||
"TED talks - Business"
|
"TED talks - Business"
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
bookIds = lib.filter(kiwix::Filter().acceptTags({"stackexchange"}));
|
TEST_F(LibraryTest, filterByTags)
|
||||||
|
{
|
||||||
|
auto bookIds = lib.filter(kiwix::Filter().acceptTags({"stackexchange"}));
|
||||||
EXPECT_EQ(ids2Titles(bookIds),
|
EXPECT_EQ(ids2Titles(bookIds),
|
||||||
TitleCollection({
|
TitleCollection({
|
||||||
"Islam Stack Exchange",
|
"Islam Stack Exchange",
|
||||||
|
@ -300,8 +306,12 @@ TEST_F(LibraryTest, filterCheck)
|
||||||
"Encyclopédie de la Tunisie"
|
"Encyclopédie de la Tunisie"
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
bookIds = lib.filter(kiwix::Filter().query("folklore"));
|
|
||||||
|
TEST_F(LibraryTest, filterByQuery)
|
||||||
|
{
|
||||||
|
auto bookIds = lib.filter(kiwix::Filter().query("folklore"));
|
||||||
EXPECT_EQ(ids2Titles(bookIds),
|
EXPECT_EQ(ids2Titles(bookIds),
|
||||||
TitleCollection({
|
TitleCollection({
|
||||||
"Mythology & Folklore Stack Exchange"
|
"Mythology & Folklore Stack Exchange"
|
||||||
|
@ -318,9 +328,12 @@ TEST_F(LibraryTest, filterCheck)
|
||||||
"Wikiquote"
|
"Wikiquote"
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bookIds = lib.filter(kiwix::Filter().query("Wiki").creator("Wiki"));
|
TEST_F(LibraryTest, filterByMultipleCriteria)
|
||||||
|
{
|
||||||
|
auto bookIds = lib.filter(kiwix::Filter().query("Wiki").creator("Wiki"));
|
||||||
EXPECT_EQ(ids2Titles(bookIds),
|
EXPECT_EQ(ids2Titles(bookIds),
|
||||||
TitleCollection({
|
TitleCollection({
|
||||||
"Granblue Fantasy Wiki"
|
"Granblue Fantasy Wiki"
|
||||||
|
|
Loading…
Reference in New Issue