mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-29 04:17:55 +01:00
make testsuite compile with C++03 compiler
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#undef min
|
||||
#include <algorithm>
|
||||
|
||||
@@ -38,7 +37,7 @@ CompressTest::~CompressTest()
|
||||
|
||||
void CompressTest::testSingleFile()
|
||||
{
|
||||
std::ofstream out(Poco::Path::temp() + "appinf.zip", std::ios::binary);
|
||||
Poco::FileOutputStream out(Poco::Path::temp() + "appinf.zip");
|
||||
Poco::Path theFile(ZipTest::getTestFile("data", "test.zip"));
|
||||
Compress c(out, true);
|
||||
c.addFile(theFile, theFile.getFileName());
|
||||
@@ -48,7 +47,7 @@ void CompressTest::testSingleFile()
|
||||
|
||||
void CompressTest::testDirectory()
|
||||
{
|
||||
std::ofstream out(Poco::Path::temp() + "pocobin.zip", std::ios::binary);
|
||||
Poco::FileOutputStream out(Poco::Path::temp() + "pocobin.zip");
|
||||
Poco::File aFile("some/");
|
||||
if (aFile.exists()) aFile.remove(true);
|
||||
Poco::File aDir("some/recursive/dir/");
|
||||
@@ -73,7 +72,7 @@ void CompressTest::testDirectory()
|
||||
void CompressTest::testManipulator()
|
||||
{
|
||||
{
|
||||
std::ofstream out(Poco::Path::temp() + "appinf.zip", std::ios::binary);
|
||||
Poco::FileOutputStream out(Poco::Path::temp() + "appinf.zip");
|
||||
Poco::Path theFile(ZipTest::getTestFile("data", "test.zip"));
|
||||
Compress c(out, true);
|
||||
c.addFile(theFile, theFile.getFileName());
|
||||
@@ -90,7 +89,7 @@ void CompressTest::testManipulator()
|
||||
void CompressTest::testManipulatorDel()
|
||||
{
|
||||
{
|
||||
std::ofstream out(Poco::Path::temp() + "appinf.zip", std::ios::binary);
|
||||
Poco::FileOutputStream out(Poco::Path::temp() + "appinf.zip");
|
||||
Poco::Path theFile(ZipTest::getTestFile("data", "test.zip"));
|
||||
Compress c(out, true);
|
||||
c.addFile(theFile, theFile.getFileName());
|
||||
@@ -108,7 +107,7 @@ void CompressTest::testManipulatorDel()
|
||||
void CompressTest::testManipulatorReplace()
|
||||
{
|
||||
{
|
||||
std::ofstream out(Poco::Path::temp() + "appinf.zip", std::ios::binary);
|
||||
Poco::FileOutputStream out(Poco::Path::temp() + "appinf.zip");
|
||||
Poco::Path theFile(ZipTest::getTestFile("data", "test.zip"));
|
||||
Compress c(out, true);
|
||||
c.addFile(theFile, theFile.getFileName());
|
||||
@@ -116,7 +115,7 @@ void CompressTest::testManipulatorReplace()
|
||||
}
|
||||
ZipManipulator zm(Poco::Path::temp() + "appinf.zip", true);
|
||||
zm.replaceFile("test.zip", ZipTest::getTestFile("data", "doc.zip"));
|
||||
|
||||
|
||||
ZipArchive archive=zm.commit();
|
||||
assert (archive.findHeader("test.zip") != archive.headerEnd());
|
||||
assert (archive.findHeader("doc.zip") == archive.headerEnd());
|
||||
@@ -126,7 +125,7 @@ void CompressTest::testManipulatorReplace()
|
||||
void CompressTest::testSetZipComment()
|
||||
{
|
||||
std::string comment("Testing...123...");
|
||||
std::ofstream out(Poco::Path::temp() + "comment.zip", std::ios::binary);
|
||||
Poco::FileOutputStream out(Poco::Path::temp() + "comment.zip");
|
||||
Poco::Path theFile(ZipTest::getTestFile("data", "test.zip"));
|
||||
Compress c(out, true);
|
||||
c.addFile(theFile, theFile.getFileName());
|
||||
@@ -138,7 +137,7 @@ void CompressTest::testSetZipComment()
|
||||
|
||||
void CompressTest::createDataFile(const std::string& path, Poco::UInt64 size)
|
||||
{
|
||||
std::ofstream out(path.c_str(), std::ios::binary | std::ios::trunc);
|
||||
Poco::FileOutputStream out(path.c_str(), std::ios::trunc);
|
||||
assert( ! out.fail() );
|
||||
Poco::Buffer<char> buffer(MB);
|
||||
for(int i = 0; size != 0; i++) {
|
||||
@@ -163,13 +162,13 @@ void CompressTest::testZip64()
|
||||
files["data1.bin"] = static_cast<Poco::UInt64>(KB)*4096+1;
|
||||
files["data2.bin"] = static_cast<Poco::UInt64>(KB)*16;
|
||||
files["data3.bin"] = static_cast<Poco::UInt64>(KB)*4096-1;
|
||||
|
||||
|
||||
for(FileMap::const_iterator it = files.begin(); it != files.end(); it++)
|
||||
{
|
||||
std::cout << '\t' << "createDataFile(" << it->first << ", " << it->second << ");" << std::endl;
|
||||
createDataFile(it->first, it->second);
|
||||
}
|
||||
std::ofstream out(Poco::Path::temp() + "zip64.zip", std::ios::binary | std::ios::trunc);
|
||||
Poco::FileOutputStream out(Poco::Path::temp() + "zip64.zip", std::ios::trunc);
|
||||
Compress c(out, true, true);
|
||||
for(FileMap::const_iterator it = files.begin(); it != files.end(); it++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user