Skip to content

Commit

Permalink
test: add test for archive function
Browse files Browse the repository at this point in the history
  • Loading branch information
lievenhey committed Oct 11, 2024
1 parent fd12018 commit 76bbf2a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
Binary file not shown.
Binary file added tests/integrationtests/archives/test.tar
Binary file not shown.
Binary file added tests/integrationtests/archives/test.tar.gz
Binary file not shown.
Binary file added tests/integrationtests/archives/test.zip
Binary file not shown.
24 changes: 24 additions & 0 deletions tests/integrationtests/tst_perfparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,30 @@ private slots:

QCOMPARE(decompressed.readAll(), QByteArrayLiteral("Hello World\n"));
}

void testArchive_data()
{
QTest::addColumn<QString>("filename");

QTest::addRow("uncompressed tar") << QFINDTESTDATA("archives/test.tar");

QTest::addRow("gzip compressed tar") << QFINDTESTDATA("archives/test.tar.gz");

QTest::addRow("zip file") << QFINDTESTDATA("archives/test.zip");

QTest::addRow("tar file with multiple files") << QFINDTESTDATA("archives/test-multi-files.tar");
}

void testArchive()
{
QFETCH(QString, filename);

PerfParser parser;
QFile decompressed(parser.decompressIfNeeded(filename));
decompressed.open(QIODevice::ReadOnly);

QCOMPARE(decompressed.readAll(), QByteArrayLiteral("Hello World\n"));
}
#endif

private:
Expand Down

0 comments on commit 76bbf2a

Please sign in to comment.