File.close();
}
+void XdxfTest::removeAccents()
+{
+ XdxfPluginSub xdxf;
+ xdxf.settings()->setValue(QString("strip_accents"), QString("true"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("nóżka")), QString("nozka"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("motor")), QString("motor"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("nÓżKa")), QString("nozka"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("ławka")), QString("lawka"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("éàèùâêîôûëïüÿäöüç")), QString("eaeuaeioueiuyaouc"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("íőűúó")), QString("iouuo"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("-ę")), QString("-e"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("\"e\"")), QString("\"e\""));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("'e'")), QString("'e'"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("\\e")), QString("e"));
+ QCOMPARE(xdxf.getRemoveAccents(QString::fromUtf8("\\")), QString(""));
+}
+
+ void XdxfTest::timeFileNormalize(){
+ QTime timer;
+ QDate date;
+ QFile File("../tests/time.xml");
+ if(!File.open(QFile::ReadWrite | QFile::Text)) {
+ qDebug()<<"Error: could not open file";
+ return;
+ }
+ QTextStream out(&File);
+ while(!out.atEnd())
+ out.seek(out.pos()+1);
+
+ XdxfPlugin xdxfPluginB(this);
+ Settings *settings=new Settings;
+ settings->setValue("path","../../../../../../dict.xdxf");
+ settings->setValue("strip_accents", "true");
+ CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+
+ timer.start();
+ xdxfPlugin->search("Bantu");
+ out<<"\n<type> SearchFile-begin with strip accent </type> <time>" << timer.elapsed();
+ out << "</time>";
+
+ timer.start();
+ xdxfPlugin->search("level");
+ out<<"\n<type> SearchFile-midle with strip accent </type> <time>" << timer.elapsed();
+ out << "</time>";
+
+ timer.start();
+ xdxfPlugin->search("zoril");
+ out<<"\n<type> SearchFile-end with strip accent </type> <time>" << timer.elapsed();
+ out << "</time>";
+
+ timer.start();
+ xdxfPlugin->searchWordList("level");
+ out<<"\n<type> SearchWordListFile with strip accent </type> <time>" << timer.elapsed();
+ out<< "</time>\n";
+
+ File.close();
+
+ }
QTEST_MAIN(XdxfTest)
//#include "testqstring.moc"