QList<Translation*> te = xdxfPlugin->searchWordList(".", 10);
if(te.size()>0)
- QCOMPARE(te.size(), 9);
+ QCOMPARE(te.size(), 1);
QList<Translation*> te2 = xdxfPlugin->searchWordList("1",10);
QCOMPARE(te2.size(), 5);
QList<Translation*> te = xdxfPlugin->searchWordList(".", 10);
if(te.size()>0)
- QCOMPARE(te.size(), 9);
+ QCOMPARE(te.size(), 1);
QList<Translation*> te2 = xdxfPlugin->searchWordList("1",10);
QCOMPARE(te2.size(), 5);
delete xdxfPlugin;
}
-void XdxfTest::timeCache()
-{
+void XdxfTest::timeCache() {
QTime timer;
QDate date;
QFile File("../tests/time.xml");
File.close();
}
-void XdxfTest::timeFile()
-{
+void XdxfTest::timeFile() {
QTime timer;
QDate date;
QFile File("../tests/time.xml");
timer.start();
xdxfPlugin->searchWordList("level");
out<<"\n<type> SearchWordListFile </type> <time>" << timer.elapsed();
- out<< "</time>\n";
+ out<< "</time>";
+
+ File.close();
+}
+
+void XdxfTest::timeCacheNormalize() {
+ 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);
+
+ timer.start();
+ XdxfPlugin xdxfPluginB(this);
+ Settings *settings=new Settings;
+ settings->setValue("path","../../../../../../dict.xdxf");
+ settings->setValue("generateCache", "true");
+ settings->setValue("strip_accents", "true");
+ CommonDictInterface *xdxfPlugin = xdxfPluginB.getNew(settings);
+
+ out<<"\n<type> Cache with strip accent </type> <time>" << timer.elapsed();
+ out<<"</time>";
+
+ timer.start();
+ xdxfPlugin->search("Bantu");
+ out<<"\n<type> SearchCache-begin with strip accent </type> <time>" << timer.elapsed();
+ out<< "</time>";
+
+ timer.start();
+ xdxfPlugin->search("level");
+ out<<"\n<type> SearchCache-midle with strip accent </type> <time>" << timer.elapsed();
+ out<< "</time>";
+
+ timer.start();
+ xdxfPlugin->search("zoril");
+ out<<"\n<type> SearchCache-end with strip accent </type> <time>" << timer.elapsed();
+ out<< "</time>";
+
+ timer.start();
+ xdxfPlugin->searchWordList("level");
+ out<<"\n<type> SearchWorlListCache with strip accent </type> <time>" << timer.elapsed();
+ out<< "</time>";
File.close();
}
+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"