diff --git a/autotest/Zip/Zip.cpp b/autotest/Zip/Zip.cpp new file mode 100644 index 000000000..b39e6f6f9 --- /dev/null +++ b/autotest/Zip/Zip.cpp @@ -0,0 +1,35 @@ +#include +#include + +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"); +} diff --git a/autotest/Zip/Zip.upp b/autotest/Zip/Zip.upp new file mode 100644 index 000000000..718f2b294 --- /dev/null +++ b/autotest/Zip/Zip.upp @@ -0,0 +1,10 @@ +uses + Core, + plugin/zip; + +file + Zip.cpp; + +mainconfig + "" = ""; +