diff options
author | Christian Kamm <mail@ckamm.de> | 2017-09-05 14:40:26 +0300 |
---|---|---|
committer | Christian Kamm <mail@ckamm.de> | 2017-09-05 14:40:26 +0300 |
commit | de7c3016540b2612293cda98586f53be9a21b4ae (patch) | |
tree | 4f298e9ffe400b95ce61766664d6c011254c9c13 /test/testsyncjournaldb.cpp | |
parent | 48d2fc1599f7017d80bbc92efd89257dc2a7f99d (diff) |
Add minor unittest for numeric id extraction #5933
Diffstat (limited to 'test/testsyncjournaldb.cpp')
-rw-r--r-- | test/testsyncjournaldb.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/testsyncjournaldb.cpp b/test/testsyncjournaldb.cpp index 9e412aa85..e01a32f13 100644 --- a/test/testsyncjournaldb.cpp +++ b/test/testsyncjournaldb.cpp @@ -163,6 +163,19 @@ private slots: QVERIFY(!wipedRecord._valid); } + void testNumericId() + { + SyncJournalFileRecord record; + + // Typical 8-digit padded id + record._fileId = "00000001abcd"; + QCOMPARE(record.numericFileId(), QByteArray("00000001")); + + // When the numeric id overflows the 8-digit boundary + record._fileId = "123456789ocidblaabcd"; + QCOMPARE(record.numericFileId(), QByteArray("123456789")); + } + private: SyncJournalDb _db; }; |