[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/pim/krss/resources/libkrssresource/tests
From:       Dmitry Ivanov <vonami () gmail ! com>
Date:       2009-04-02 8:34:56
Message-ID: 1238661296.732525.32666.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 948096 by divanov:

Add benchmark tests.


 A             README  
 AM            gettestdata.sh  
 M  +17 -0     importitemsjobtest.cpp  
 M  +1 -0      importitemsjobtest.h  
 M  +23 -1     itemimportreadertest.cpp  
 M  +2 -1      itemimportreadertest.h  


** trunk/playground/pim/krss/resources/libkrssresource/tests/gettestdata.sh #property \
svn:executable  + *
--- trunk/playground/pim/krss/resources/libkrssresource/tests/importitemsjobtest.cpp \
#948095:948096 @@ -128,4 +128,21 @@
     }
 }
 
+void ImportItemsJobTest::testPerformance()
+{
+    const QString kdehome = qgetenv( "KDEHOME" );
+    KRssResource::ImportItemsJob *ijob = new KRssResource::ImportItemsJob( \
"http://planetkde.org/rss20.xml", this ); +    ijob->setResourceId( \
"akonadi_opml_rss_resource_0" ); +    ijob->setFlagsSynchronizable( false );
+    if ( !QFile::exists( kdehome + "/planetkde-performance.xml" ) ) {
+        qDebug() << "Skipping the performance test";
+        return;
+    }
+
+    ijob->setSourceFile( kdehome + "/planetkde-performance.xml" );
+    QBENCHMARK {
+        QVERIFY( ijob->exec() );
+    }
+}
+
 #include "importitemsjobtest.moc"
--- trunk/playground/pim/krss/resources/libkrssresource/tests/importitemsjobtest.h \
#948095:948096 @@ -26,6 +26,7 @@
 private Q_SLOTS:
     void initTestCase();
     void testCorrectness();
+    void testPerformance();
 };
 
 #endif // KRSSRESOURCE_IMPORTITEMSJOBTEST_H
--- trunk/playground/pim/krss/resources/libkrssresource/tests/itemimportreadertest.cpp \
#948095:948096 @@ -26,7 +26,7 @@
 
 QTEST_KDEMAIN( ItemImportReaderTest, NoGUI )
 
-void ItemImportReaderTest::testGoodXml()
+void ItemImportReaderTest::testCorrectness()
 {
     QFile file( QString( "%1/unittestenv/kdehome2/planetkde-correctness.xml" ).arg( \
TESTDATAPATH ) );  QVERIFY( file.open( QFile::ReadOnly ) );
@@ -93,4 +93,26 @@
     file.close();
 }
 
+void ItemImportReaderTest::testPerformance()
+{
+    QFile file( QString( "%1/unittestenv/kdehome2/planetkde-performance.xml" ).arg( \
TESTDATAPATH ) ); +    if ( !file.exists() ) {
+        qDebug() << "Skipping the performance test";
+        return;
+    }
+    QVERIFY( file.open( QFile::ReadOnly ) );
+    KRssResource::ItemImportReader reader( &file );
+
+    int num = 0;
+    QHash<QString, Akonadi::Item> items;
+    QBENCHMARK {
+        while ( reader.hasNext() ) {
+            const Akonadi::Item item = reader.nextItem();
+            QVERIFY( !item.remoteId().isEmpty() );
+            items.insert( item.remoteId(), item );
+            ++num;
+        }
+    }
+}
+
 #include "itemimportreadertest.moc"
--- trunk/playground/pim/krss/resources/libkrssresource/tests/itemimportreadertest.h \
#948095:948096 @@ -24,7 +24,8 @@
 {
     Q_OBJECT
 private Q_SLOTS:
-    void testGoodXml();
+    void testCorrectness();
+    void testPerformance();
 };
 
 #endif // KRSSRESOURCE_ITEMIMPORTREADERTEST_H


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic