MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / read

Method read

lib/QuaZip/qztest/testquaziodevice.cpp:31–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29#include <QtTest/QtTest>
30
31void TestQuaZIODevice::read()
32{
33 QByteArray buf(256, 0);
34 z_stream zouts;
35 zouts.zalloc = (alloc_func) NULL;
36 zouts.zfree = (free_func) NULL;
37 zouts.opaque = NULL;
38 deflateInit(&zouts, Z_DEFAULT_COMPRESSION);
39 zouts.next_in = reinterpret_cast<Bytef*>(const_cast<char*>("test"));
40 zouts.avail_in = 4;
41 zouts.next_out = reinterpret_cast<Bytef*>(buf.data());
42 zouts.avail_out = buf.size();
43 deflate(&zouts, Z_FINISH);
44 deflateEnd(&zouts);
45 QBuffer testBuffer(&buf);
46 testBuffer.open(QIODevice::ReadOnly);
47 QuaZIODevice testDevice(&testBuffer);
48 QVERIFY(testDevice.open(QIODevice::ReadOnly));
49 char outBuf[5];
50 QCOMPARE(testDevice.read(outBuf, 5), static_cast<qint64>(4));
51 testDevice.close();
52 QVERIFY(!testDevice.isOpen());
53}
54
55void TestQuaZIODevice::readMany()
56{

Callers 1

readManyMethod · 0.45

Calls 5

dataMethod · 0.45
sizeMethod · 0.45
openMethod · 0.45
closeMethod · 0.45
isOpenMethod · 0.45

Tested by

no test coverage detected