mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-06 05:24:13 -04:00
Test if reset() and close() write only one final block.
This commit is contained in:
parent
2033174d95
commit
98d9dae087
4 changed files with 36 additions and 0 deletions
|
@ -73,6 +73,21 @@ void TestHashedBlockStream::testWriteRead()
|
|||
buffer.buffer().clear();
|
||||
}
|
||||
|
||||
void TestHashedBlockStream::testReset()
|
||||
{
|
||||
QBuffer buffer;
|
||||
QVERIFY(buffer.open(QIODevice::WriteOnly));
|
||||
|
||||
HashedBlockStream writer(&buffer, 16);
|
||||
QVERIFY(writer.open(QIODevice::WriteOnly));
|
||||
QCOMPARE(writer.write(QByteArray(8, 'Z')), qint64(8));
|
||||
// test if reset() and close() write only one final block
|
||||
QVERIFY(writer.reset());
|
||||
QVERIFY(writer.reset());
|
||||
writer.close();
|
||||
QCOMPARE(buffer.buffer().size(), 8 + (32 + 4 + 4) * 2);
|
||||
}
|
||||
|
||||
void TestHashedBlockStream::testWriteFailure()
|
||||
{
|
||||
FailDevice failDevice(1500);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue