summaryrefslogtreecommitdiffstats
path: root/tests/storagetest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/storagetest.cpp')
-rw-r--r--tests/storagetest.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp
index 9e9bad9..3368549 100644
--- a/tests/storagetest.cpp
+++ b/tests/storagetest.cpp
@@ -542,6 +542,35 @@ private slots:
542 } 542 }
543 543
544 } 544 }
545
546 void testRecordUid()
547 {
548 Sink::Storage::DataStore store(testDataPath, dbName, Sink::Storage::DataStore::ReadWrite);
549 auto transaction = store.createTransaction(Sink::Storage::DataStore::ReadWrite);
550 Sink::Storage::DataStore::recordUid(transaction, "uid1", "type");
551 Sink::Storage::DataStore::recordUid(transaction, "uid2", "type");
552 Sink::Storage::DataStore::recordUid(transaction, "uid3", "type2");
553
554 {
555 QVector<QByteArray> uids;
556 Sink::Storage::DataStore::getUids("type", transaction, [&](const QByteArray &r) {
557 uids << r;
558 });
559 QVector<QByteArray> expected{{"uid1"}, {"uid2"}};
560 QCOMPARE(uids, expected);
561 }
562
563 Sink::Storage::DataStore::removeUid(transaction, "uid2", "type");
564
565 {
566 QVector<QByteArray> uids;
567 Sink::Storage::DataStore::getUids("type", transaction, [&](const QByteArray &r) {
568 uids << r;
569 });
570 QVector<QByteArray> expected{{"uid1"}};
571 QCOMPARE(uids, expected);
572 }
573 }
545}; 574};
546 575
547QTEST_MAIN(StorageTest) 576QTEST_MAIN(StorageTest)