summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2018-06-27 11:12:38 +0200
committerMinijackson <minijackson@riseup.net>2018-07-04 15:37:14 +0200
commit016fea734d09df707be9a16a4ad6a1107f41549f (patch)
tree60bf9767842713538505fca80515a8f5e59ca985 /tests
parentc90ba4a98292a39eb0b3df12fd7e2dec0300e58d (diff)
downloadsink-016fea734d09df707be9a16a4ad6a1107f41549f.tar.gz
sink-016fea734d09df707be9a16a4ad6a1107f41549f.zip
Fix pipelinetest + remove useless commented lines
Diffstat (limited to 'tests')
-rw-r--r--tests/pipelinetest.cpp13
-rw-r--r--tests/storagetest.cpp9
2 files changed, 11 insertions, 11 deletions
diff --git a/tests/pipelinetest.cpp b/tests/pipelinetest.cpp
index 5165d35..2610305 100644
--- a/tests/pipelinetest.cpp
+++ b/tests/pipelinetest.cpp
@@ -22,6 +22,8 @@
22#include "adaptorfactoryregistry.h" 22#include "adaptorfactoryregistry.h"
23#include "storage/key.h" 23#include "storage/key.h"
24 24
25// TODO: fix test
26
25static void removeFromDisk(const QString &name) 27static void removeFromDisk(const QString &name)
26{ 28{
27 Sink::Storage::DataStore store(Sink::Store::storageLocation(), name, Sink::Storage::DataStore::ReadWrite); 29 Sink::Storage::DataStore store(Sink::Store::storageLocation(), name, Sink::Storage::DataStore::ReadWrite);
@@ -379,8 +381,7 @@ private slots:
379 pipeline.newEntity(command.constData(), command.size()); 381 pipeline.newEntity(command.constData(), command.size());
380 QCOMPARE(testProcessor->newUids.size(), 1); 382 QCOMPARE(testProcessor->newUids.size(), 1);
381 QCOMPARE(testProcessor->newRevisions.size(), 1); 383 QCOMPARE(testProcessor->newRevisions.size(), 1);
382 // Key doesn't contain revision and is just the uid 384 const auto uid = Sink::Storage::Identifier::fromDisplayByteArray(testProcessor->newUids.at(0)).toDisplayByteArray();
383 const auto uid = Sink::Storage::Key::fromDisplayByteArray(testProcessor->newUids.at(0)).identifier().toDisplayByteArray();
384 QCOMPARE(testProcessor->newUids.at(0), uid); 385 QCOMPARE(testProcessor->newUids.at(0), uid);
385 } 386 }
386 pipeline.commit(); 387 pipeline.commit();
@@ -388,14 +389,13 @@ private slots:
388 pipeline.startTransaction(); 389 pipeline.startTransaction();
389 auto keys = getKeys(instanceIdentifier(), "event.main"); 390 auto keys = getKeys(instanceIdentifier(), "event.main");
390 QCOMPARE(keys.size(), 1); 391 QCOMPARE(keys.size(), 1);
391 const auto uid = Sink::Storage::Key::fromDisplayByteArray(keys.first()).identifier().toDisplayByteArray(); 392 const auto uid = Sink::Storage::Key::fromInternalByteArray(keys.first()).identifier().toDisplayByteArray();
392 { 393 {
393 auto modifyCommand = modifyEntityCommand(createEvent(entityFbb, "summary2"), uid, 1); 394 auto modifyCommand = modifyEntityCommand(createEvent(entityFbb, "summary2"), uid, 1);
394 pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size()); 395 pipeline.modifiedEntity(modifyCommand.constData(), modifyCommand.size());
395 QCOMPARE(testProcessor->modifiedUids.size(), 1); 396 QCOMPARE(testProcessor->modifiedUids.size(), 1);
396 QCOMPARE(testProcessor->modifiedRevisions.size(), 1); 397 QCOMPARE(testProcessor->modifiedRevisions.size(), 1);
397 // Key doesn't contain revision and is just the uid 398 const auto uid2 = Sink::Storage::Identifier::fromDisplayByteArray(testProcessor->modifiedUids.at(0)).toDisplayByteArray();
398 const auto uid2 = Sink::Storage::Key::fromDisplayByteArray(testProcessor->modifiedUids.at(0)).identifier().toDisplayByteArray();
399 QCOMPARE(testProcessor->modifiedUids.at(0), uid2); 399 QCOMPARE(testProcessor->modifiedUids.at(0), uid2);
400 } 400 }
401 pipeline.commit(); 401 pipeline.commit();
@@ -407,8 +407,7 @@ private slots:
407 QCOMPARE(testProcessor->deletedUids.size(), 1); 407 QCOMPARE(testProcessor->deletedUids.size(), 1);
408 QCOMPARE(testProcessor->deletedUids.size(), 1); 408 QCOMPARE(testProcessor->deletedUids.size(), 1);
409 QCOMPARE(testProcessor->deletedSummaries.size(), 1); 409 QCOMPARE(testProcessor->deletedSummaries.size(), 1);
410 // Key doesn't contain revision and is just the uid 410 const auto uid2 = Sink::Storage::Identifier::fromDisplayByteArray(testProcessor->modifiedUids.at(0)).toDisplayByteArray();
411 const auto uid2 = Sink::Storage::Key::fromDisplayByteArray(testProcessor->modifiedUids.at(0)).identifier().toDisplayByteArray();
412 QCOMPARE(testProcessor->deletedUids.at(0), uid2); 411 QCOMPARE(testProcessor->deletedUids.at(0), uid2);
413 QCOMPARE(testProcessor->deletedSummaries.at(0), QByteArray("summary2")); 412 QCOMPARE(testProcessor->deletedSummaries.at(0), QByteArray("summary2"));
414 } 413 }
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp
index d3f180a..2ddbebf 100644
--- a/tests/storagetest.cpp
+++ b/tests/storagetest.cpp
@@ -457,10 +457,11 @@ private slots:
457 auto db = transaction.openDatabase("test", nullptr, false); 457 auto db = transaction.openDatabase("test", nullptr, false);
458 const auto uid = "{c5d06a9f-1534-4c52-b8ea-415db68bdadf}"; 458 const auto uid = "{c5d06a9f-1534-4c52-b8ea-415db68bdadf}";
459 //Ensure we can sort 1 and 10 properly (by default string comparison 10 comes before 6) 459 //Ensure we can sort 1 and 10 properly (by default string comparison 10 comes before 6)
460 const auto key1 = Sink::Storage::Key(Sink::Storage::Identifier::fromDisplayByteArray(uid), 6); 460 const auto id = Sink::Storage::Identifier::fromDisplayByteArray(uid);
461 db.write(key1.toInternalByteArray(), "value1"); 461 auto key = Sink::Storage::Key(id, 6);
462 const auto key2 = Sink::Storage::Key(Sink::Storage::Identifier::fromDisplayByteArray(uid), 10); 462 db.write(key.toInternalByteArray(), "value1");
463 db.write(key2.toInternalByteArray(), "value2"); 463 key.setRevision(10);
464 db.write(key.toInternalByteArray(), "value2");
464 db.findLatest(uid, [&](const QByteArray &key, const QByteArray &value) { result = value; }); 465 db.findLatest(uid, [&](const QByteArray &key, const QByteArray &value) { result = value; });
465 QCOMPARE(result, QByteArray("value2")); 466 QCOMPARE(result, QByteArray("value2"));
466 } 467 }