| 1 | // |
| 2 | // ZipTest.h |
| 3 | // |
| 4 | // Definition of the ZipTest class. |
| 5 | // |
| 6 | // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. |
| 7 | // and Contributors. |
| 8 | // |
| 9 | // SPDX-License-Identifier: BSL-1.0 |
| 10 | // |
| 11 | |
| 12 | |
| 13 | #ifndef ZipTest_INCLUDED |
| 14 | #define ZipTest_INCLUDED |
| 15 | |
| 16 | |
| 17 | #include "Poco/Zip/Zip.h" |
| 18 | #include "Poco/Zip/ZipLocalFileHeader.h" |
| 19 | #include "Poco/CppUnit/TestCase.h" |
| 20 | |
| 21 | |
| 22 | class ZipTest: public CppUnit::TestCase |
| 23 | { |
| 24 | public: |
| 25 | ZipTest(const std::string& name); |
| 26 | ~ZipTest(); |
| 27 | |
| 28 | void testSkipSingleFile(); |
| 29 | void testDecompressSingleFile(); |
| 30 | void testDecompressSingleFileInDir(); |
| 31 | void testDecompress(); |
| 32 | void testDecompressFlat(); |
| 33 | void testDecompressVuln(); |
| 34 | void testDecompressFlatVuln(); |
| 35 | void testCrcAndSizeAfterData(); |
| 36 | void testCrcAndSizeAfterDataWithArchive(); |
| 37 | void testCrcAndSizeAfterDataEncapsulated(); |
| 38 | |
| 39 | static const Poco::UInt64 KB = 1024; |
| 40 | static const Poco::UInt64 MB = 1024*KB; |
| 41 | void verifyDataFile(const std::string& path, Poco::UInt64 size); |
| 42 | void testDecompressZip64(); |
| 43 | void testValidPath(); |
| 44 | |
| 45 | void setUp(); |
| 46 | void tearDown(); |
| 47 | |
| 48 | static CppUnit::Test* suite(); |
| 49 | |
| 50 | static std::string getTestFile(const std::string& directory, const std::string& type); |
| 51 | |
| 52 | private: |
| 53 | void (const void* pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string>& info); |
| 54 | |
| 55 | int _errCnt; |
| 56 | }; |
| 57 | |
| 58 | |
| 59 | #endif // ZipTest_INCLUDED |
| 60 | |