MCPcopy Create free account
hub / github.com/aria2/aria2 / testDecode

Method testDecode

test/GZipDecoderTest.cc:31–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29CPPUNIT_TEST_SUITE_REGISTRATION(GZipDecoderTest);
30
31void GZipDecoderTest::testDecode()
32{
33 GZipDecoder decoder;
34 decoder.init();
35
36 std::string outfile(A2_TEST_OUT_DIR "/aria2_GZipDecoderTest_testDecode");
37
38 char buf[4_k];
39 std::ifstream in(A2_TEST_DIR "/gzip_decode_test.gz", std::ios::binary);
40 std::ofstream out(outfile.c_str(), std::ios::binary);
41 while (in) {
42 in.read(buf, sizeof(buf));
43
44 std::string r = decoder.decode(reinterpret_cast<const unsigned char*>(buf),
45 in.gcount());
46
47 out.write(r.data(), r.size());
48 }
49 CPPUNIT_ASSERT(decoder.finished());
50 decoder.release();
51
52 out.close();
53
54 CPPUNIT_ASSERT_EQUAL(std::string("8b577b33c0411b2be9d4fa74c7402d54a8d21f96"),
55 fileHexDigest(MessageDigest::sha1().get(), outfile));
56}
57
58} // namespace aria2

Callers

nothing calls this directly

Calls 12

fileHexDigestFunction · 0.85
decodeMethod · 0.80
dataMethod · 0.80
sha1Function · 0.50
initMethod · 0.45
readMethod · 0.45
writeMethod · 0.45
sizeMethod · 0.45
finishedMethod · 0.45
releaseMethod · 0.45
closeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected