195 db.add_database(db2);
197 TEST_EQUAL(db.get_spelling_suggestion(
"hello"),
"");
198 TEST_EQUAL(db.get_spelling_suggestion(
"hell"),
"hello");
200 TEST_EQUAL(db2.get_spelling_suggestion(
"hell"),
"hello");
212 i = db2.spellings_begin();
219 TEST(i == db2.spellings_end());
221 i = db.spellings_begin();
231 TEST(i == db.spellings_end());
234 i = db.spellings_begin();
236 TEST(i != db.spellings_end());
240 TEST(i == db.spellings_end());
262 #define TARGET "\xe4\xb8\x80\xe4\xba\x9b"
#define TEST(a)
Test a condition, without an additional explanation for failure.
This class is used to access a database, or a group of databases.
void remove_spelling(const std::string &word, Xapian::termcount freqdec=1) const
Remove a word from the spelling dictionary.
Xapian::WritableDatabase get_writable_database(const string &dbname)
a generic test suite engine
test functionality of the Xapian API
Class for iterating over a list of terms.
This class provides read/write access to a database.
Xapian::TermIterator spellings_begin() const
An iterator which returns all the spelling correction targets.
Public interfaces for the Xapian library.
void commit()
Commit any pending modifications made to the database.
Xapian::Database get_writable_database_as_database()
void add_database(const Database &database)
Add an existing database (or group of databases) to those accessed by this object.
std::string get_spelling_suggestion(const std::string &word, unsigned max_edit_distance=2) const
Suggest a spelling correction.
Xapian::Database get_database(const string &dbname)
DEFINE_TESTCASE(spell0,(spelling||remote) &&writable)
Xapian-specific test helper functions and macros.
Xapian::TermIterator spellings_end() const
Corresponding end iterator to spellings_begin().
#define TEST_EQUAL(a, b)
Test for equality of two things.
void add_spelling(const std::string &word, Xapian::termcount freqinc=1) const
Add a word to the spelling dictionary.