diff --git a/test/spelling_correction.cpp b/test/spelling_correction.cpp index f353c462..13b1ac53 100644 --- a/test/spelling_correction.cpp +++ b/test/spelling_correction.cpp @@ -42,17 +42,14 @@ protected: } }; +void testSpellingCorrections(const kiwix::SpellingsDB& spellingsDB) +{ #define EXPECT_SPELLING_CORRECTION(query, maxSuggestions, parenthesizedExpectedResult) \ EXPECT_EQ( \ spellingsDB.getSpellingCorrections(query, maxSuggestions), \ std::vector parenthesizedExpectedResult \ ) -TEST_F(SpellingCorrectionTest, allInOne) -{ - const auto archive = zim::Archive("./test/spelling_correction_test.zim"); - kiwix::SpellingsDB spellingsDB(archive, TEST_DB_PATH); - EXPECT_SPELLING_CORRECTION("", 1, ({})); EXPECT_SPELLING_CORRECTION("geflekt", 1, ({"gefleckt"})); @@ -171,3 +168,10 @@ TEST_F(SpellingCorrectionTest, allInOne) // EXPECT_SPELLING_CORRECTION("Kung", 2, ({"King", "Kong"})); EXPECT_THROW(spellingsDB.getSpellingCorrections("Kung", 2), std::runtime_error); } + +TEST_F(SpellingCorrectionTest, allInOne) +{ + const auto archive = zim::Archive("./test/spelling_correction_test.zim"); + kiwix::SpellingsDB spellingsDB(archive, TEST_DB_PATH); + testSpellingCorrections(spellingsDB); +}