.autotest

git-svn-id: svn://ultimatepp.org/upp/trunk@11083 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2017-05-14 12:12:02 +00:00
parent 37e050fda4
commit 3660561f27
2 changed files with 45 additions and 0 deletions

35
autotest/Zip/Zip.cpp Normal file
View file

@ -0,0 +1,35 @@
#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");
}

10
autotest/Zip/Zip.upp Normal file
View file

@ -0,0 +1,10 @@
uses
Core,
plugin/zip;
file
Zip.cpp;
mainconfig
"" = "";