Mercurial > hg > orthanc
annotate OrthancFramework/UnitTestsSources/ZipTests.cpp @ 4059:e241e5f3f088 framework
moved LuaTests and MemoryCacheTests from OrthancServer to OrthancFramework
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 11 Jun 2020 14:12:07 +0200 |
parents | 05b8fd21089c |
children | 0953b3dc3261 |
rev | line source |
---|---|
827
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
1 /** |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1277
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
827
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
6 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
8 * modify it under the terms of the GNU General Public License as |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
9 * published by the Free Software Foundation, either version 3 of the |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
10 * License, or (at your option) any later version. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
11 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
12 * In addition, as a special exception, the copyright holders of this |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
13 * program give permission to link the code of its release with the |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
15 * that use the same license as the "OpenSSL" library), and distribute |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
16 * the linked executables. You must obey the GNU General Public License |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
17 * in all respects for all of the code used other than "OpenSSL". If you |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
18 * modify file(s) with this exception, you may extend this exception to |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
19 * your version of the file(s), but you are not obligated to do so. If |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
20 * you do not wish to do so, delete this exception statement from your |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
21 * version. If you delete this exception statement from all source files |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
22 * in the program, then also delete it here. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
23 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
24 * This program is distributed in the hope that it will be useful, but |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
25 * WITHOUT ANY WARRANTY; without even the implied warranty of |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
27 * General Public License for more details. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
28 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
29 * You should have received a copy of the GNU General Public License |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
31 **/ |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
32 |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
33 |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
34 #if ORTHANC_UNIT_TESTS_LINK_FRAMEWORK == 1 |
4014
27628b0f6ada
merging logging code for plugins and files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3992
diff
changeset
|
35 # include <OrthancFramework.h> |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
36 #endif |
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
37 |
81 | 38 #include "gtest/gtest.h" |
39 | |
4045 | 40 #include "../Sources/OrthancException.h" |
41 #include "../Sources/Compression/ZipWriter.h" | |
42 #include "../Sources/Compression/HierarchicalZipWriter.h" | |
43 #include "../Sources/Toolbox.h" | |
81 | 44 |
45 | |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
46 using namespace Orthanc; |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
47 |
81 | 48 TEST(ZipWriter, Basic) |
49 { | |
50 Orthanc::ZipWriter w; | |
803
4689e400e0fa
directory to store the results of the unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
644
diff
changeset
|
51 w.SetOutputPath("UnitTestsResults/hello.zip"); |
81 | 52 w.Open(); |
249 | 53 w.OpenFile("world/hello"); |
81 | 54 w.Write("Hello world"); |
55 } | |
56 | |
57 | |
644
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
58 TEST(ZipWriter, Basic64) |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
59 { |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
60 Orthanc::ZipWriter w; |
803
4689e400e0fa
directory to store the results of the unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
644
diff
changeset
|
61 w.SetOutputPath("UnitTestsResults/hello64.zip"); |
644
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
62 w.SetZip64(true); |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
63 w.Open(); |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
64 w.OpenFile("world/hello"); |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
65 w.Write("Hello world"); |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
66 } |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
67 |
eb5a0b21d05e
do not use ZIP64 as the default format anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
632
diff
changeset
|
68 |
81 | 69 TEST(ZipWriter, Exceptions) |
70 { | |
71 Orthanc::ZipWriter w; | |
72 ASSERT_THROW(w.Open(), Orthanc::OrthancException); | |
803
4689e400e0fa
directory to store the results of the unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
644
diff
changeset
|
73 w.SetOutputPath("UnitTestsResults/hello3.zip"); |
81 | 74 w.Open(); |
75 ASSERT_THROW(w.Write("hello world"), Orthanc::OrthancException); | |
76 } | |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
77 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
78 |
1277
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
79 TEST(ZipWriter, Append) |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
80 { |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
81 { |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
82 Orthanc::ZipWriter w; |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
83 w.SetAppendToExisting(false); |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
84 w.SetOutputPath("UnitTestsResults/append.zip"); |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
85 w.Open(); |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
86 w.OpenFile("world/hello"); |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
87 w.Write("Hello world 1"); |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
88 } |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
89 |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
90 { |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
91 Orthanc::ZipWriter w; |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
92 w.SetAppendToExisting(true); |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
93 w.SetOutputPath("UnitTestsResults/append.zip"); |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
94 w.Open(); |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
95 w.OpenFile("world/appended"); |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
96 w.Write("Hello world 2"); |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
97 } |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
98 } |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
99 |
46bca019587e
primitives to add new content to existing ZIP files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
967
diff
changeset
|
100 |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
101 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
102 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
103 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
104 namespace Orthanc |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
105 { |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
106 // The namespace is necessary |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
107 // http://code.google.com/p/googletest/wiki/AdvancedGuide#Private_Class_Members |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
108 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
109 TEST(HierarchicalZipWriter, Index) |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
110 { |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
111 HierarchicalZipWriter::Index i; |
249 | 112 ASSERT_EQ("hello", i.OpenFile("hello")); |
113 ASSERT_EQ("hello-2", i.OpenFile("hello")); | |
114 ASSERT_EQ("coucou", i.OpenFile("coucou")); | |
115 ASSERT_EQ("hello-3", i.OpenFile("hello")); | |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
116 |
249 | 117 i.OpenDirectory("coucou"); |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
118 |
249 | 119 ASSERT_EQ("coucou-2/world", i.OpenFile("world")); |
120 ASSERT_EQ("coucou-2/world-2", i.OpenFile("world")); | |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
121 |
249 | 122 i.OpenDirectory("world"); |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
123 |
249 | 124 ASSERT_EQ("coucou-2/world-3/hello", i.OpenFile("hello")); |
125 ASSERT_EQ("coucou-2/world-3/hello-2", i.OpenFile("hello")); | |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
126 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
127 i.CloseDirectory(); |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
128 |
249 | 129 ASSERT_EQ("coucou-2/world-4", i.OpenFile("world")); |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
130 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
131 i.CloseDirectory(); |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
132 |
249 | 133 ASSERT_EQ("coucou-3", i.OpenFile("coucou")); |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
134 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
135 ASSERT_THROW(i.CloseDirectory(), OrthancException); |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
136 } |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
137 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
138 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
139 TEST(HierarchicalZipWriter, Filenames) |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
140 { |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
141 ASSERT_EQ("trE hell", HierarchicalZipWriter::Index::KeepAlphanumeric(" ÊtrE hellô ")); |
251 | 142 |
143 // The "^" character is considered as a space in DICOM | |
144 ASSERT_EQ("Hel lo world", HierarchicalZipWriter::Index::KeepAlphanumeric(" Hel^^ ^\r\n\t^^lo \t <world> ")); | |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
145 } |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
146 } |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
147 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
148 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
149 TEST(HierarchicalZipWriter, Basic) |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
150 { |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
151 static const std::string SPACES = " "; |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
152 |
803
4689e400e0fa
directory to store the results of the unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
644
diff
changeset
|
153 HierarchicalZipWriter w("UnitTestsResults/hello2.zip"); |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
154 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
155 w.SetCompressionLevel(0); |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
156 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
157 // Inside "/" |
249 | 158 w.OpenFile("hello"); |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
159 w.Write(SPACES + "hello\n"); |
249 | 160 w.OpenFile("hello"); |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
161 w.Write(SPACES + "hello-2\n"); |
249 | 162 w.OpenDirectory("hello"); |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
163 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
164 // Inside "/hello-3" |
249 | 165 w.OpenFile("hello"); |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
166 w.Write(SPACES + "hello\n"); |
249 | 167 w.OpenDirectory("hello"); |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
168 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
169 w.SetCompressionLevel(9); |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
170 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
171 // Inside "/hello-3/hello-2" |
249 | 172 w.OpenFile("hello"); |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
173 w.Write(SPACES + "hello\n"); |
249 | 174 w.OpenFile("hello"); |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
175 w.Write(SPACES + "hello-2\n"); |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
176 w.CloseDirectory(); |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
177 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
178 // Inside "/hello-3" |
249 | 179 w.OpenFile("hello"); |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
180 w.Write(SPACES + "hello-3\n"); |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
181 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
182 /** |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
183 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
184 TO CHECK THE CONTENT OF THE "hello2.zip" FILE: |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
185 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
186 # unzip -v hello2.zip |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
187 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
188 => There must be 6 files. The first 3 files must have a negative |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
189 compression ratio. |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
190 |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
191 **/ |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
81
diff
changeset
|
192 } |