ultimatepp/autotest/Zip/Zip.cpp
cxl 3660561f27 .autotest
git-svn-id: svn://ultimatepp.org/upp/trunk@11083 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2017-05-14 12:12:02 +00:00

35 lines
874 B
C++

#include <Core/Core.h>
#include <plugin/zip/zip.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_COUT|LOG_FILE);
StringZip z;
z.WriteFile("this is content of file1", "file1");
z.WriteFile("this is content of file2", "file2");
String data = z.Finish();
StringUnZip unzip(data);
for(int pass = 0; pass < 2; pass++) {
ASSERT(!unzip.IsEof());
ASSERT(unzip.GetPath() == "file1");
ASSERT(unzip.ReadFile() == "this is content of file1");
ASSERT(!unzip.IsEof());
ASSERT(unzip.GetPath() == "file2");
ASSERT(unzip.ReadFile() == "this is content of file2");
ASSERT(unzip.IsEof());
unzip.Seek(0);
}
ASSERT(unzip.ReadFile("file1") == "this is content of file1");
ASSERT(unzip.ReadFile("file2") == "this is content of file2");
ASSERT(unzip.ReadFile("file3").IsVoid());
LOG("================= OK");
}