4#include <QTemporaryFile>
5#include <QtTest/QtTest>
19void TestCrc32::cleanupTestCase ()
23void TestCrc32::initTestCase ()
32void TestCrc32::testFileBinary ()
37 temp.setAutoRemove (
false);
42 filename = temp.fileName ();
44 int length =
sizeof (
inBuffer) /
sizeof (
unsigned char) - 1;
46 QDataStream str (&temp);
47 str.writeBytes ((
const char*)
inBuffer, length);
53 outGot = crc32.
filecrc (filename);
55 QFile::remove (filename);
61void TestCrc32::testFileText ()
66 temp.setAutoRemove (
false);
71 filename = temp.fileName ();
73 QTextStream str (&temp);
74 str << QString ((
const char*)
inBuffer);
80 outGot = crc32.
filecrc (filename);
82 QFile::remove (filename);
88void TestCrc32::testMemory ()
92 int length =
sizeof (
inBuffer) /
sizeof (
unsigned char) - 1;
void initializeLogging(const QString &name, const QString &filename, bool isDebug)
unsigned outExpectedBinary
unsigned memcrc(const unsigned char *b, unsigned int n) const
Compute the checksum using data in memory.
unsigned filecrc(const QString &filename) const
Compute the checksum using data in file.
Unit tests of crc32 checksum algorithm.
TestCrc32(QObject *parent=0)
Single constructor.