Skip to content

Commit

Permalink
trailing commas removed, indentation fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
maneeshpm committed Feb 23, 2021
1 parent 66b922f commit 0d04fc4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion test/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ if gtest_dep.found() and not meson.is_cross_build()
test(test_name, test_exe, timeout : 120,
workdir: meson.current_build_dir())
endforeach
endif
endif
26 changes: 10 additions & 16 deletions test/suggestion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,14 @@ namespace {

// Helper class to create a temporary directory and zim from titles list
// Remove the file along with the temporary directory once test is done.
class TempZimArchive : zim::unittests::TempFile {
class TempZimArchive : zim::unittests::TempFile {
public:
std::string tempZimPath;
TempZimArchive(const char* tempPath) : zim::unittests::TempFile {tempPath} {}

zim::Archive createZimFromTitles(std::vector<std::string> titles) {
tempZimPath = this->path() + ".zim";
zim::writer::Creator creator;
creator.configIndexing(true, "eng");
creator.startZimCreation(tempZimPath);
creator.startZimCreation(this->path());

// add dummy items with given titles
for (auto title : titles) {
Expand All @@ -61,11 +59,7 @@ namespace {
}
creator.addMetadata("Title", "This is a title");
creator.finishZimCreation();
return zim::Archive(tempZimPath);
}

~TempZimArchive() {
remove(tempZimPath.c_str());
return zim::Archive(this->path());
}
};

Expand All @@ -92,7 +86,7 @@ namespace {
"hotel berlin, berlin",
"again berlin",
"berlin",
"not berlin",
"not berlin"
};

std::vector<std::string> expectedResult = {};
Expand All @@ -112,7 +106,7 @@ namespace {
"hotel berlin, berlin",
"again berlin",
"berlin",
"not berlin",
"not berlin"
};

std::vector<std::string> expectedResult = {};
Expand All @@ -131,15 +125,15 @@ namespace {
"hotel berlin, berlin",
"again berlin",
"berlin",
"not berlin",
"not berlin"
};

std::vector<std::string> expectedResult = {
"berlin",
"hotel berlin, berlin",
"again berlin",
"berlin wall",
"not berlin",
"not berlin"
};

TempZimArchive tza("testZim");
Expand All @@ -155,12 +149,12 @@ namespace {
"foobar a",
"foobar c",
"foobar e",
"foobar d",
"foobar d"
};

std::vector<std::string> expectedResult = {
"foobar a",
"foobar b",
"foobar b"
};
TempZimArchive tza("testZim");
const zim::Archive archive = tza.createZimFromTitles(titles);
Expand All @@ -184,7 +178,7 @@ namespace {
"In mid Summer",
"Shivers in summer",
"Summer in Berlin",
"Summer in Paradise",
"Summer in Paradise"
};

TempZimArchive tza("testZim");
Expand Down

0 comments on commit 0d04fc4

Please sign in to comment.