// krazy:excludeall=spelling /** * SPDX-FileCopyrightText: 2007 Zack Rusin * * SPDX-License-Identifier: LGPL-2.1-or-later */ #include "test_core.h" #include "speller.h" #include #include #include QTEST_GUILESS_MAIN(SonnetCoreTest) using namespace Sonnet; void SonnetCoreTest::testCore() { Speller dict(QStringLiteral("en_US")); qDebug() << "Clients are " << dict.availableBackends(); qDebug() << "Languages are " << dict.availableLanguages(); qDebug() << "Language names are " << dict.availableLanguageNames(); qDebug() << "Language dicts " << dict.availableDictionaries(); QStringList words; words.reserve(5 * 35); for (int i = 0; i < 35; ++i) { words << QStringLiteral("hello") << QStringLiteral("helo") << QStringLiteral("enviroment") << QStringLiteral("guvernment") << QStringLiteral("farted"); } QElapsedTimer mtime; mtime.start(); for (QStringList::Iterator itr = words.begin(); itr != words.end(); ++itr) { if (!dict.isCorrect(*itr)) { // qDebug()<<"Word " << *itr <<" is misspelled"; QStringList sug = dict.suggest(*itr); // qDebug()<<"Suggestions : "<