From de7c3016540b2612293cda98586f53be9a21b4ae Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Tue, 5 Sep 2017 13:40:26 +0200 Subject: Add minor unittest for numeric id extraction #5933 --- test/testsyncjournaldb.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/testsyncjournaldb.cpp') 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; }; -- cgit v1.2.3