diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-13 12:42:31 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-09-13 12:42:31 +0200 |
commit | c12a9a09da59b9e418316dba02e6215cb55e47ee (patch) | |
tree | 05498d9a42e399bcca787f40c1fc473fb09e680e /tests/storagetest.cpp | |
parent | 55fe06979ceebe67553135b43aa47e70d931304b (diff) | |
parent | ebdb89b8bb482bbb5ecd544c3d38bef35fc7d820 (diff) | |
download | sink-2cbc37da82bb06757c38f891c465a24219268d3b.tar.gz sink-2cbc37da82bb06757c38f891c465a24219268d3b.zip |
Merge commit 'ebdb89b8bb482bbb5ecd544c3d38bef35fc7d820'v0.4.0
Diffstat (limited to 'tests/storagetest.cpp')
-rw-r--r-- | tests/storagetest.cpp | 29 |
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 | ||
547 | QTEST_MAIN(StorageTest) | 576 | QTEST_MAIN(StorageTest) |