summaryrefslogtreecommitdiffstats
path: root/tests/storagetest.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-01-15 23:04:22 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-01-15 23:04:22 +0100
commita0f517df8c4633d33820186954bdf803941e92bf (patch)
tree45a5939c2bede838b73e55a84e703e7cf2f42e17 /tests/storagetest.cpp
parente8b2898efcd2225adc7b14329cc246d9b29f1fa6 (diff)
downloadsink-a0f517df8c4633d33820186954bdf803941e92bf.tar.gz
sink-a0f517df8c4633d33820186954bdf803941e92bf.zip
storagetest
Diffstat (limited to 'tests/storagetest.cpp')
-rw-r--r--tests/storagetest.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp
index 6c1d02b..516fe85 100644
--- a/tests/storagetest.cpp
+++ b/tests/storagetest.cpp
@@ -59,6 +59,8 @@ private Q_SLOTS:
59 { 59 {
60 testDataPath = "./testdb"; 60 testDataPath = "./testdb";
61 dbName = "test"; 61 dbName = "test";
62 Akonadi2::Storage storage(testDataPath, dbName);
63 storage.removeFromDisk();
62 } 64 }
63 65
64 void cleanupTestCase() 66 void cleanupTestCase()
@@ -136,6 +138,23 @@ private Q_SLOTS:
136 store.removeFromDisk(); 138 store.removeFromDisk();
137 } 139 }
138 140
141 void testReadEmptyDb()
142 {
143 bool gotResult = false;
144 bool gotError = false;
145 Akonadi2::Storage store(testDataPath, dbName, Akonadi2::Storage::ReadWrite);
146 store.scan(0, 0, [&](void *keyValue, int keySize, void *dataValue, int dataSize) -> bool {
147 gotResult = true;
148 return false;
149 },
150 [&](Akonadi2::Storage::Error) {
151 gotError = true;
152 });
153 QVERIFY(!gotResult);
154 QVERIFY(!gotError);
155 store.removeFromDisk();
156 }
157
139 void testConcurrentRead() 158 void testConcurrentRead()
140 { 159 {
141 const int count = 10000; 160 const int count = 10000;
@@ -170,6 +189,8 @@ private Q_SLOTS:
170 { 189 {
171 Akonadi2::Storage storage(testDataPath, dbName); 190 Akonadi2::Storage storage(testDataPath, dbName);
172 storage.removeFromDisk(); 191 storage.removeFromDisk();
192 Akonadi2::Storage storage2(testDataPath, dbName + "2");
193 storage2.removeFromDisk();
173 } 194 }
174 } 195 }
175}; 196};