Mercurial > hg > orthanc
annotate UnitTestsSources/UnitTestsMain.cpp @ 1017:9d0c7301596e lua-scripting
storescp modality
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 10 Jul 2014 10:43:47 +0200 |
parents | 886652370ff2 |
children | 509e146c3cb3 |
rev | line source |
---|---|
827
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
1 /** |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege, |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
4 * Belgium |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
5 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
6 * This program is free software: you can redistribute it and/or |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
7 * 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:
810
diff
changeset
|
8 * published by the Free Software Foundation, either version 3 of the |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
9 * License, or (at your option) any later version. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
10 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
11 * In addition, as a special exception, the copyright holders of this |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
12 * 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:
810
diff
changeset
|
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
14 * that use the same license as the "OpenSSL" library), and distribute |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
15 * the linked executables. You must obey the GNU General Public License |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
16 * 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:
810
diff
changeset
|
17 * 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:
810
diff
changeset
|
18 * 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:
810
diff
changeset
|
19 * 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:
810
diff
changeset
|
20 * version. If you delete this exception statement from all source files |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
21 * in the program, then also delete it here. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
22 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
23 * 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:
810
diff
changeset
|
24 * WITHOUT ANY WARRANTY; without even the implied warranty of |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
26 * General Public License for more details. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
27 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
28 * 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:
810
diff
changeset
|
29 * 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:
810
diff
changeset
|
30 **/ |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
31 |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
810
diff
changeset
|
32 |
831
84513f2ee1f3
pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
827
diff
changeset
|
33 #include "PrecompiledHeadersUnitTests.h" |
434
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
34 #include "../Core/EnumerationDictionary.h" |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
35 |
0 | 36 #include "gtest/gtest.h" |
37 | |
38 #include <ctype.h> | |
39 | |
40 #include "../Core/Compression/ZlibCompressor.h" | |
41 #include "../Core/DicomFormat/DicomTag.h" | |
42 #include "../Core/HttpServer/HttpHandler.h" | |
63 | 43 #include "../Core/OrthancException.h" |
0 | 44 #include "../Core/Toolbox.h" |
45 #include "../Core/Uuid.h" | |
63 | 46 #include "../OrthancServer/OrthancInitialization.h" |
0 | 47 |
63 | 48 using namespace Orthanc; |
0 | 49 |
50 | |
51 TEST(Uuid, Generation) | |
52 { | |
53 for (int i = 0; i < 10; i++) | |
54 { | |
55 std::string s = Toolbox::GenerateUuid(); | |
56 ASSERT_TRUE(Toolbox::IsUuid(s)); | |
57 } | |
58 } | |
59 | |
60 TEST(Uuid, Test) | |
61 { | |
62 ASSERT_FALSE(Toolbox::IsUuid("")); | |
63 ASSERT_FALSE(Toolbox::IsUuid("012345678901234567890123456789012345")); | |
64 ASSERT_TRUE(Toolbox::IsUuid("550e8400-e29b-41d4-a716-446655440000")); | |
708 | 65 ASSERT_FALSE(Toolbox::IsUuid("550e8400-e29b-41d4-a716-44665544000_")); |
707
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
66 ASSERT_FALSE(Toolbox::IsUuid("01234567890123456789012345678901234_")); |
402 | 67 ASSERT_FALSE(Toolbox::StartsWithUuid("550e8400-e29b-41d4-a716-44665544000")); |
68 ASSERT_TRUE(Toolbox::StartsWithUuid("550e8400-e29b-41d4-a716-446655440000")); | |
69 ASSERT_TRUE(Toolbox::StartsWithUuid("550e8400-e29b-41d4-a716-446655440000 ok")); | |
70 ASSERT_FALSE(Toolbox::StartsWithUuid("550e8400-e29b-41d4-a716-446655440000ok")); | |
71 } | |
72 | |
73 TEST(Toolbox, IsSHA1) | |
74 { | |
75 ASSERT_FALSE(Toolbox::IsSHA1("")); | |
76 ASSERT_FALSE(Toolbox::IsSHA1("01234567890123456789012345678901234567890123")); | |
77 ASSERT_FALSE(Toolbox::IsSHA1("012345678901234567890123456789012345678901234")); | |
78 ASSERT_TRUE(Toolbox::IsSHA1("b5ed549f-956400ce-69a8c063-bf5b78be-2732a4b9")); | |
79 | |
80 std::string s; | |
81 Toolbox::ComputeSHA1(s, "The quick brown fox jumps over the lazy dog"); | |
82 ASSERT_TRUE(Toolbox::IsSHA1(s)); | |
83 ASSERT_EQ("2fd4e1c6-7a2d28fc-ed849ee1-bb76e739-1b93eb12", s); | |
707
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
84 |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
85 ASSERT_FALSE(Toolbox::IsSHA1("b5ed549f-956400ce-69a8c063-bf5b78be-2732a4b_")); |
0 | 86 } |
87 | |
708 | 88 static void StringToVector(std::vector<uint8_t>& v, |
89 const std::string& s) | |
90 { | |
91 v.resize(s.size()); | |
92 for (size_t i = 0; i < s.size(); i++) | |
93 v[i] = s[i]; | |
94 } | |
95 | |
96 | |
0 | 97 TEST(Zlib, Basic) |
98 { | |
99 std::string s = Toolbox::GenerateUuid(); | |
100 s = s + s + s + s; | |
101 | |
708 | 102 std::string compressed, compressed2; |
103 ZlibCompressor c; | |
104 c.Compress(compressed, s); | |
105 | |
106 std::vector<uint8_t> v, vv; | |
107 StringToVector(v, s); | |
108 c.Compress(compressed2, v); | |
109 ASSERT_EQ(compressed, compressed2); | |
110 | |
111 std::string uncompressed; | |
112 c.Uncompress(uncompressed, compressed); | |
113 ASSERT_EQ(s.size(), uncompressed.size()); | |
114 ASSERT_EQ(0, memcmp(&s[0], &uncompressed[0], s.size())); | |
115 | |
116 StringToVector(vv, compressed); | |
117 c.Uncompress(uncompressed, vv); | |
118 ASSERT_EQ(s.size(), uncompressed.size()); | |
119 ASSERT_EQ(0, memcmp(&s[0], &uncompressed[0], s.size())); | |
120 } | |
121 | |
122 | |
123 TEST(Zlib, Level) | |
124 { | |
125 std::string s = Toolbox::GenerateUuid(); | |
126 s = s + s + s + s; | |
127 | |
128 std::string compressed, compressed2; | |
129 ZlibCompressor c; | |
130 c.SetCompressionLevel(9); | |
131 c.Compress(compressed, s); | |
132 | |
133 c.SetCompressionLevel(0); | |
134 c.Compress(compressed2, s); | |
135 | |
136 ASSERT_TRUE(compressed.size() < compressed2.size()); | |
137 } | |
138 | |
139 | |
727 | 140 TEST(Zlib, DISABLED_Corrupted) // Disabled because it may result in a crash |
708 | 141 { |
142 std::string s = Toolbox::GenerateUuid(); | |
143 s = s + s + s + s; | |
144 | |
0 | 145 std::string compressed; |
146 ZlibCompressor c; | |
147 c.Compress(compressed, s); | |
148 | |
708 | 149 compressed[compressed.size() - 1] = 'a'; |
150 std::string u; | |
0 | 151 |
708 | 152 ASSERT_THROW(c.Uncompress(u, compressed), OrthancException); |
0 | 153 } |
154 | |
708 | 155 |
0 | 156 TEST(Zlib, Empty) |
157 { | |
158 std::string s = ""; | |
708 | 159 std::vector<uint8_t> v, vv; |
0 | 160 |
708 | 161 std::string compressed, compressed2; |
0 | 162 ZlibCompressor c; |
163 c.Compress(compressed, s); | |
708 | 164 c.Compress(compressed2, v); |
165 ASSERT_EQ(compressed, compressed2); | |
0 | 166 |
167 std::string uncompressed; | |
168 c.Uncompress(uncompressed, compressed); | |
708 | 169 ASSERT_EQ(0u, uncompressed.size()); |
0 | 170 |
708 | 171 StringToVector(vv, compressed); |
172 c.Uncompress(uncompressed, vv); | |
0 | 173 ASSERT_EQ(0u, uncompressed.size()); |
174 } | |
175 | |
708 | 176 |
0 | 177 TEST(ParseGetQuery, Basic) |
178 { | |
179 HttpHandler::Arguments a; | |
180 HttpHandler::ParseGetQuery(a, "aaa=baaa&bb=a&aa=c"); | |
181 ASSERT_EQ(3u, a.size()); | |
182 ASSERT_EQ(a["aaa"], "baaa"); | |
183 ASSERT_EQ(a["bb"], "a"); | |
184 ASSERT_EQ(a["aa"], "c"); | |
185 } | |
186 | |
187 TEST(ParseGetQuery, BasicEmpty) | |
188 { | |
189 HttpHandler::Arguments a; | |
190 HttpHandler::ParseGetQuery(a, "aaa&bb=aa&aa"); | |
191 ASSERT_EQ(3u, a.size()); | |
192 ASSERT_EQ(a["aaa"], ""); | |
193 ASSERT_EQ(a["bb"], "aa"); | |
194 ASSERT_EQ(a["aa"], ""); | |
195 } | |
196 | |
197 TEST(ParseGetQuery, Single) | |
198 { | |
199 HttpHandler::Arguments a; | |
200 HttpHandler::ParseGetQuery(a, "aaa=baaa"); | |
201 ASSERT_EQ(1u, a.size()); | |
202 ASSERT_EQ(a["aaa"], "baaa"); | |
203 } | |
204 | |
205 TEST(ParseGetQuery, SingleEmpty) | |
206 { | |
207 HttpHandler::Arguments a; | |
208 HttpHandler::ParseGetQuery(a, "aaa"); | |
209 ASSERT_EQ(1u, a.size()); | |
210 ASSERT_EQ(a["aaa"], ""); | |
211 } | |
212 | |
213 TEST(Uri, SplitUriComponents) | |
214 { | |
966
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
215 UriComponents c, d; |
0 | 216 Toolbox::SplitUriComponents(c, "/cou/hello/world"); |
217 ASSERT_EQ(3u, c.size()); | |
218 ASSERT_EQ("cou", c[0]); | |
219 ASSERT_EQ("hello", c[1]); | |
220 ASSERT_EQ("world", c[2]); | |
221 | |
222 Toolbox::SplitUriComponents(c, "/cou/hello/world/"); | |
223 ASSERT_EQ(3u, c.size()); | |
224 ASSERT_EQ("cou", c[0]); | |
225 ASSERT_EQ("hello", c[1]); | |
226 ASSERT_EQ("world", c[2]); | |
227 | |
228 Toolbox::SplitUriComponents(c, "/cou/hello/world/a"); | |
229 ASSERT_EQ(4u, c.size()); | |
230 ASSERT_EQ("cou", c[0]); | |
231 ASSERT_EQ("hello", c[1]); | |
232 ASSERT_EQ("world", c[2]); | |
233 ASSERT_EQ("a", c[3]); | |
234 | |
235 Toolbox::SplitUriComponents(c, "/"); | |
236 ASSERT_EQ(0u, c.size()); | |
237 | |
238 Toolbox::SplitUriComponents(c, "/hello"); | |
239 ASSERT_EQ(1u, c.size()); | |
240 ASSERT_EQ("hello", c[0]); | |
241 | |
242 Toolbox::SplitUriComponents(c, "/hello/"); | |
243 ASSERT_EQ(1u, c.size()); | |
244 ASSERT_EQ("hello", c[0]); | |
245 | |
63 | 246 ASSERT_THROW(Toolbox::SplitUriComponents(c, ""), OrthancException); |
247 ASSERT_THROW(Toolbox::SplitUriComponents(c, "a"), OrthancException); | |
207 | 248 ASSERT_THROW(Toolbox::SplitUriComponents(c, "/coucou//coucou"), OrthancException); |
707
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
249 |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
250 c.clear(); |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
251 c.push_back("test"); |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
252 ASSERT_EQ("/", Toolbox::FlattenUri(c, 10)); |
0 | 253 } |
254 | |
255 | |
966
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
256 TEST(Uri, Truncate) |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
257 { |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
258 UriComponents c, d; |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
259 Toolbox::SplitUriComponents(c, "/cou/hello/world"); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
260 |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
261 Toolbox::TruncateUri(d, c, 0); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
262 ASSERT_EQ(3u, d.size()); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
263 ASSERT_EQ("cou", d[0]); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
264 ASSERT_EQ("hello", d[1]); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
265 ASSERT_EQ("world", d[2]); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
266 |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
267 Toolbox::TruncateUri(d, c, 1); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
268 ASSERT_EQ(2u, d.size()); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
269 ASSERT_EQ("hello", d[0]); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
270 ASSERT_EQ("world", d[1]); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
271 |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
272 Toolbox::TruncateUri(d, c, 2); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
273 ASSERT_EQ(1u, d.size()); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
274 ASSERT_EQ("world", d[0]); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
275 |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
276 Toolbox::TruncateUri(d, c, 3); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
277 ASSERT_EQ(0u, d.size()); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
278 |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
279 Toolbox::TruncateUri(d, c, 4); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
280 ASSERT_EQ(0u, d.size()); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
281 |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
282 Toolbox::TruncateUri(d, c, 5); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
283 ASSERT_EQ(0u, d.size()); |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
284 } |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
285 |
886652370ff2
accelerating REST API matching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
949
diff
changeset
|
286 |
0 | 287 TEST(Uri, Child) |
288 { | |
289 UriComponents c1; Toolbox::SplitUriComponents(c1, "/hello/world"); | |
290 UriComponents c2; Toolbox::SplitUriComponents(c2, "/hello/hello"); | |
291 UriComponents c3; Toolbox::SplitUriComponents(c3, "/hello"); | |
292 UriComponents c4; Toolbox::SplitUriComponents(c4, "/world"); | |
293 UriComponents c5; Toolbox::SplitUriComponents(c5, "/"); | |
294 | |
295 ASSERT_TRUE(Toolbox::IsChildUri(c1, c1)); | |
296 ASSERT_FALSE(Toolbox::IsChildUri(c1, c2)); | |
297 ASSERT_FALSE(Toolbox::IsChildUri(c1, c3)); | |
298 ASSERT_FALSE(Toolbox::IsChildUri(c1, c4)); | |
299 ASSERT_FALSE(Toolbox::IsChildUri(c1, c5)); | |
300 | |
301 ASSERT_FALSE(Toolbox::IsChildUri(c2, c1)); | |
302 ASSERT_TRUE(Toolbox::IsChildUri(c2, c2)); | |
303 ASSERT_FALSE(Toolbox::IsChildUri(c2, c3)); | |
304 ASSERT_FALSE(Toolbox::IsChildUri(c2, c4)); | |
305 ASSERT_FALSE(Toolbox::IsChildUri(c2, c5)); | |
306 | |
307 ASSERT_TRUE(Toolbox::IsChildUri(c3, c1)); | |
308 ASSERT_TRUE(Toolbox::IsChildUri(c3, c2)); | |
309 ASSERT_TRUE(Toolbox::IsChildUri(c3, c3)); | |
310 ASSERT_FALSE(Toolbox::IsChildUri(c3, c4)); | |
311 ASSERT_FALSE(Toolbox::IsChildUri(c3, c5)); | |
312 | |
313 ASSERT_FALSE(Toolbox::IsChildUri(c4, c1)); | |
314 ASSERT_FALSE(Toolbox::IsChildUri(c4, c2)); | |
315 ASSERT_FALSE(Toolbox::IsChildUri(c4, c3)); | |
316 ASSERT_TRUE(Toolbox::IsChildUri(c4, c4)); | |
317 ASSERT_FALSE(Toolbox::IsChildUri(c4, c5)); | |
318 | |
319 ASSERT_TRUE(Toolbox::IsChildUri(c5, c1)); | |
320 ASSERT_TRUE(Toolbox::IsChildUri(c5, c2)); | |
321 ASSERT_TRUE(Toolbox::IsChildUri(c5, c3)); | |
322 ASSERT_TRUE(Toolbox::IsChildUri(c5, c4)); | |
323 ASSERT_TRUE(Toolbox::IsChildUri(c5, c5)); | |
324 } | |
325 | |
326 TEST(Uri, AutodetectMimeType) | |
327 { | |
328 ASSERT_EQ("", Toolbox::AutodetectMimeType("../NOTES")); | |
329 ASSERT_EQ("", Toolbox::AutodetectMimeType("")); | |
330 ASSERT_EQ("", Toolbox::AutodetectMimeType("/")); | |
331 ASSERT_EQ("", Toolbox::AutodetectMimeType("a/a")); | |
332 | |
333 ASSERT_EQ("text/plain", Toolbox::AutodetectMimeType("../NOTES.txt")); | |
334 ASSERT_EQ("text/plain", Toolbox::AutodetectMimeType("../coucou.xml/NOTES.txt")); | |
335 ASSERT_EQ("text/xml", Toolbox::AutodetectMimeType("../.xml")); | |
336 | |
337 ASSERT_EQ("application/javascript", Toolbox::AutodetectMimeType("NOTES.js")); | |
338 ASSERT_EQ("application/json", Toolbox::AutodetectMimeType("NOTES.json")); | |
339 ASSERT_EQ("application/pdf", Toolbox::AutodetectMimeType("NOTES.pdf")); | |
340 ASSERT_EQ("text/css", Toolbox::AutodetectMimeType("NOTES.css")); | |
341 ASSERT_EQ("text/html", Toolbox::AutodetectMimeType("NOTES.html")); | |
342 ASSERT_EQ("text/plain", Toolbox::AutodetectMimeType("NOTES.txt")); | |
343 ASSERT_EQ("text/xml", Toolbox::AutodetectMimeType("NOTES.xml")); | |
344 ASSERT_EQ("image/gif", Toolbox::AutodetectMimeType("NOTES.gif")); | |
345 ASSERT_EQ("image/jpeg", Toolbox::AutodetectMimeType("NOTES.jpg")); | |
346 ASSERT_EQ("image/jpeg", Toolbox::AutodetectMimeType("NOTES.jpeg")); | |
347 ASSERT_EQ("image/png", Toolbox::AutodetectMimeType("NOTES.png")); | |
348 } | |
349 | |
22 | 350 TEST(Toolbox, ComputeMD5) |
351 { | |
352 std::string s; | |
353 | |
354 // # echo -n "Hello" | md5sum | |
355 | |
356 Toolbox::ComputeMD5(s, "Hello"); | |
357 ASSERT_EQ("8b1a9953c4611296a827abf8c47804d7", s); | |
358 Toolbox::ComputeMD5(s, ""); | |
359 ASSERT_EQ("d41d8cd98f00b204e9800998ecf8427e", s); | |
360 } | |
361 | |
177 | 362 TEST(Toolbox, ComputeSHA1) |
363 { | |
364 std::string s; | |
365 | |
366 Toolbox::ComputeSHA1(s, "The quick brown fox jumps over the lazy dog"); | |
367 ASSERT_EQ("2fd4e1c6-7a2d28fc-ed849ee1-bb76e739-1b93eb12", s); | |
368 Toolbox::ComputeSHA1(s, ""); | |
369 ASSERT_EQ("da39a3ee-5e6b4b0d-3255bfef-95601890-afd80709", s); | |
370 } | |
371 | |
372 | |
809
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
373 static std::string EncodeBase64Bis(const std::string& s) |
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
374 { |
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
375 std::string result; |
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
376 Toolbox::EncodeBase64(result, s); |
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
377 return result; |
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
378 } |
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
379 |
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
380 |
24 | 381 TEST(Toolbox, Base64) |
382 { | |
809
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
383 ASSERT_EQ("", EncodeBase64Bis("")); |
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
384 ASSERT_EQ("YQ==", EncodeBase64Bis("a")); |
707
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
385 |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
386 const std::string hello = "SGVsbG8gd29ybGQ="; |
809
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
387 ASSERT_EQ(hello, EncodeBase64Bis("Hello world")); |
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
388 |
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
389 std::string decoded; |
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
390 Toolbox::DecodeBase64(decoded, hello); |
8ce2f69436ca
do not return strings with base64
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
803
diff
changeset
|
391 ASSERT_EQ("Hello world", decoded); |
24 | 392 } |
393 | |
87
8517e2c44283
path to configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
394 TEST(Toolbox, PathToExecutable) |
8517e2c44283
path to configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
395 { |
8517e2c44283
path to configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
396 printf("[%s]\n", Toolbox::GetPathToExecutable().c_str()); |
8517e2c44283
path to configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
397 printf("[%s]\n", Toolbox::GetDirectoryOfExecutable().c_str()); |
8517e2c44283
path to configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
398 } |
8517e2c44283
path to configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
399 |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
235
diff
changeset
|
400 TEST(Toolbox, StripSpaces) |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
235
diff
changeset
|
401 { |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
235
diff
changeset
|
402 ASSERT_EQ("", Toolbox::StripSpaces(" \t \r \n ")); |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
235
diff
changeset
|
403 ASSERT_EQ("coucou", Toolbox::StripSpaces(" coucou \t \r \n ")); |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
235
diff
changeset
|
404 ASSERT_EQ("cou cou", Toolbox::StripSpaces(" cou cou \n ")); |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
235
diff
changeset
|
405 ASSERT_EQ("c", Toolbox::StripSpaces(" \n\t c\r \n ")); |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
235
diff
changeset
|
406 } |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
407 |
707
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
408 TEST(Toolbox, Case) |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
409 { |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
410 std::string s = "CoU"; |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
411 std::string ss; |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
412 |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
413 Toolbox::ToUpperCase(ss, s); |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
414 ASSERT_EQ("COU", ss); |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
415 Toolbox::ToLowerCase(ss, s); |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
416 ASSERT_EQ("cou", ss); |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
417 |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
418 s = "CoU"; |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
419 Toolbox::ToUpperCase(s); |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
420 ASSERT_EQ("COU", s); |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
421 |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
422 s = "CoU"; |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
423 Toolbox::ToLowerCase(s); |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
424 ASSERT_EQ("cou", s); |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
425 } |
203157cb4fde
unit tests of httpclient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
674
diff
changeset
|
426 |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
427 |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
428 #include <glog/logging.h> |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
429 |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
430 TEST(Logger, Basic) |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
431 { |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
432 LOG(INFO) << "I say hello"; |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
433 } |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
434 |
107
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
435 TEST(Toolbox, ConvertFromLatin1) |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
436 { |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
437 // This is a Latin-1 test string |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
438 const unsigned char data[10] = { 0xe0, 0xe9, 0xea, 0xe7, 0x26, 0xc6, 0x61, 0x62, 0x63, 0x00 }; |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
439 |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
440 /*FILE* f = fopen("/tmp/tutu", "w"); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
441 fwrite(&data[0], 9, 1, f); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
442 fclose(f);*/ |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
443 |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
444 std::string s((char*) &data[0], 10); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
445 ASSERT_EQ("&abc", Toolbox::ConvertToAscii(s)); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
446 |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
447 // Open in Emacs, then save with UTF-8 encoding, then "hexdump -C" |
949
766a57997121
enumeration for encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
930
diff
changeset
|
448 std::string utf8 = Toolbox::ConvertToUtf8(s, Encoding_Latin1); |
235 | 449 ASSERT_EQ(15u, utf8.size()); |
107
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
450 ASSERT_EQ(0xc3, static_cast<unsigned char>(utf8[0])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
451 ASSERT_EQ(0xa0, static_cast<unsigned char>(utf8[1])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
452 ASSERT_EQ(0xc3, static_cast<unsigned char>(utf8[2])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
453 ASSERT_EQ(0xa9, static_cast<unsigned char>(utf8[3])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
454 ASSERT_EQ(0xc3, static_cast<unsigned char>(utf8[4])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
455 ASSERT_EQ(0xaa, static_cast<unsigned char>(utf8[5])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
456 ASSERT_EQ(0xc3, static_cast<unsigned char>(utf8[6])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
457 ASSERT_EQ(0xa7, static_cast<unsigned char>(utf8[7])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
458 ASSERT_EQ(0x26, static_cast<unsigned char>(utf8[8])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
459 ASSERT_EQ(0xc3, static_cast<unsigned char>(utf8[9])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
460 ASSERT_EQ(0x86, static_cast<unsigned char>(utf8[10])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
461 ASSERT_EQ(0x61, static_cast<unsigned char>(utf8[11])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
462 ASSERT_EQ(0x62, static_cast<unsigned char>(utf8[12])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
463 ASSERT_EQ(0x63, static_cast<unsigned char>(utf8[13])); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
464 ASSERT_EQ(0x00, static_cast<unsigned char>(utf8[14])); // Null-terminated string |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
465 } |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
466 |
336 | 467 TEST(Toolbox, UrlDecode) |
468 { | |
469 std::string s; | |
470 | |
471 s = "Hello%20World"; | |
472 Toolbox::UrlDecode(s); | |
473 ASSERT_EQ("Hello World", s); | |
474 | |
337 | 475 s = "%21%23%24%26%27%28%29%2A%2B%2c%2f%3A%3b%3d%3f%40%5B%5D%90%ff"; |
336 | 476 Toolbox::UrlDecode(s); |
337 | 477 std::string ss = "!#$&'()*+,/:;=?@[]"; |
478 ss.push_back((char) 144); | |
479 ss.push_back((char) 255); | |
480 ASSERT_EQ(ss, s); | |
336 | 481 |
482 s = "(2000%2C00A4)+Other"; | |
483 Toolbox::UrlDecode(s); | |
484 ASSERT_EQ("(2000,00A4) Other", s); | |
485 } | |
486 | |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
487 |
429
09b3c6265a94
unit test for fedora 18 problem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
402
diff
changeset
|
488 #if defined(__linux) |
09b3c6265a94
unit test for fedora 18 problem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
402
diff
changeset
|
489 TEST(OrthancInitialization, AbsoluteDirectory) |
09b3c6265a94
unit test for fedora 18 problem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
402
diff
changeset
|
490 { |
810
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
809
diff
changeset
|
491 ASSERT_EQ("/tmp/hello", Configuration::InterpretRelativePath("/tmp", "hello")); |
401a9633e492
configuration into a namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
809
diff
changeset
|
492 ASSERT_EQ("/tmp", Configuration::InterpretRelativePath("/tmp", "/tmp")); |
429
09b3c6265a94
unit test for fedora 18 problem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
402
diff
changeset
|
493 } |
09b3c6265a94
unit test for fedora 18 problem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
402
diff
changeset
|
494 #endif |
09b3c6265a94
unit test for fedora 18 problem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
402
diff
changeset
|
495 |
09b3c6265a94
unit test for fedora 18 problem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
402
diff
changeset
|
496 |
434
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
497 |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
498 #include "../OrthancServer/ServerEnumerations.h" |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
499 |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
500 TEST(EnumerationDictionary, Simple) |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
501 { |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
502 Toolbox::EnumerationDictionary<MetadataType> d; |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
503 |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
504 ASSERT_THROW(d.Translate("ReceptionDate"), OrthancException); |
435
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
505 ASSERT_EQ(MetadataType_ModifiedFrom, d.Translate("5")); |
436
d51186bf7602
read access to metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
435
diff
changeset
|
506 ASSERT_EQ(256, d.Translate("256")); |
434
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
507 |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
508 d.Add(MetadataType_Instance_ReceptionDate, "ReceptionDate"); |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
509 |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
510 ASSERT_EQ(MetadataType_Instance_ReceptionDate, d.Translate("ReceptionDate")); |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
511 ASSERT_EQ(MetadataType_Instance_ReceptionDate, d.Translate("2")); |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
512 ASSERT_EQ("ReceptionDate", d.Translate(MetadataType_Instance_ReceptionDate)); |
435
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
513 |
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
514 ASSERT_THROW(d.Add(MetadataType_Instance_ReceptionDate, "Hello"), OrthancException); |
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
515 ASSERT_THROW(d.Add(MetadataType_ModifiedFrom, "ReceptionDate"), OrthancException); // already used |
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
516 ASSERT_THROW(d.Add(MetadataType_ModifiedFrom, "1024"), OrthancException); // cannot register numbers |
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
517 d.Add(MetadataType_ModifiedFrom, "ModifiedFrom"); // ok |
434
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
518 } |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
519 |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
520 |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
521 TEST(EnumerationDictionary, ServerEnumerations) |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
522 { |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
523 ASSERT_STREQ("Patient", EnumerationToString(ResourceType_Patient)); |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
524 ASSERT_STREQ("Study", EnumerationToString(ResourceType_Study)); |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
525 ASSERT_STREQ("Series", EnumerationToString(ResourceType_Series)); |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
526 ASSERT_STREQ("Instance", EnumerationToString(ResourceType_Instance)); |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
527 |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
528 ASSERT_STREQ("ModifiedSeries", EnumerationToString(ChangeType_ModifiedSeries)); |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
529 |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
530 ASSERT_STREQ("Failure", EnumerationToString(StoreStatus_Failure)); |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
531 ASSERT_STREQ("Success", EnumerationToString(StoreStatus_Success)); |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
532 |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
533 ASSERT_STREQ("CompletedSeries", EnumerationToString(ChangeType_CompletedSeries)); |
435
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
534 |
437 | 535 ASSERT_EQ("IndexInSeries", EnumerationToString(MetadataType_Instance_IndexInSeries)); |
536 ASSERT_EQ("LastUpdate", EnumerationToString(MetadataType_LastUpdate)); | |
435
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
537 |
559 | 538 ASSERT_EQ(ResourceType_Patient, StringToResourceType("PATienT")); |
539 ASSERT_EQ(ResourceType_Study, StringToResourceType("STudy")); | |
540 ASSERT_EQ(ResourceType_Series, StringToResourceType("SeRiEs")); | |
541 ASSERT_EQ(ResourceType_Instance, StringToResourceType("INStance")); | |
542 ASSERT_EQ(ResourceType_Instance, StringToResourceType("IMagE")); | |
543 ASSERT_THROW(StringToResourceType("heLLo"), OrthancException); | |
544 | |
435
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
545 ASSERT_EQ(2047, StringToMetadata("2047")); |
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
546 ASSERT_THROW(StringToMetadata("Ceci est un test"), OrthancException); |
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
547 ASSERT_THROW(RegisterUserMetadata(128, ""), OrthancException); // too low (< 1024) |
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
548 ASSERT_THROW(RegisterUserMetadata(128000, ""), OrthancException); // too high (> 65535) |
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
549 RegisterUserMetadata(2047, "Ceci est un test"); |
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
550 ASSERT_EQ(2047, StringToMetadata("2047")); |
28ba73274919
registration of user-defined metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
434
diff
changeset
|
551 ASSERT_EQ(2047, StringToMetadata("Ceci est un test")); |
434
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
552 } |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
553 |
ccf3a0a43dac
EnumerationDictionary
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
430
diff
changeset
|
554 |
450 | 555 |
483
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
556 TEST(Toolbox, WriteFile) |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
557 { |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
558 std::string path; |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
559 |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
560 { |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
561 Toolbox::TemporaryFile tmp; |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
562 path = tmp.GetPath(); |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
563 |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
564 std::string s; |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
565 s.append("Hello"); |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
566 s.push_back('\0'); |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
567 s.append("World"); |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
568 ASSERT_EQ(11u, s.size()); |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
569 |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
570 Toolbox::WriteFile(s, path.c_str()); |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
571 |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
572 std::string t; |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
573 Toolbox::ReadFile(t, path.c_str()); |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
574 |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
575 ASSERT_EQ(11u, t.size()); |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
576 ASSERT_EQ(0, t[5]); |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
577 ASSERT_EQ(0, memcmp(s.c_str(), t.c_str(), s.size())); |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
578 } |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
579 |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
580 std::string u; |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
581 ASSERT_THROW(Toolbox::ReadFile(u, path.c_str()), OrthancException); |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
582 } |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
583 |
8c3573d28868
export dicom instances to the filesystem
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
476
diff
changeset
|
584 |
608 | 585 TEST(Toolbox, Wildcard) |
586 { | |
587 ASSERT_EQ("abcd", Toolbox::WildcardToRegularExpression("abcd")); | |
588 ASSERT_EQ("ab.*cd", Toolbox::WildcardToRegularExpression("ab*cd")); | |
589 ASSERT_EQ("ab..cd", Toolbox::WildcardToRegularExpression("ab??cd")); | |
590 ASSERT_EQ("a.*b.c.*d", Toolbox::WildcardToRegularExpression("a*b?c*d")); | |
591 ASSERT_EQ("a\\{b\\]", Toolbox::WildcardToRegularExpression("a{b]")); | |
592 } | |
593 | |
594 | |
595 TEST(Toolbox, Tokenize) | |
596 { | |
597 std::vector<std::string> t; | |
598 | |
599 Toolbox::TokenizeString(t, "", ','); | |
600 ASSERT_EQ(1, t.size()); | |
601 ASSERT_EQ("", t[0]); | |
602 | |
603 Toolbox::TokenizeString(t, "abc", ','); | |
604 ASSERT_EQ(1, t.size()); | |
605 ASSERT_EQ("abc", t[0]); | |
606 | |
607 Toolbox::TokenizeString(t, "ab,cd,ef,", ','); | |
608 ASSERT_EQ(4, t.size()); | |
609 ASSERT_EQ("ab", t[0]); | |
610 ASSERT_EQ("cd", t[1]); | |
611 ASSERT_EQ("ef", t[2]); | |
612 ASSERT_EQ("", t[3]); | |
613 } | |
614 | |
615 | |
674
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
616 |
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
617 #if defined(__linux) |
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
618 #include <endian.h> |
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
619 #endif |
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
620 |
637 | 621 TEST(Toolbox, Endianness) |
622 { | |
674
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
623 // Parts of this test come from Adam Conrad |
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
624 // http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=728822#5 |
637 | 625 |
626 #if defined(_WIN32) | |
627 ASSERT_EQ(Endianness_Little, Toolbox::DetectEndianness()); | |
674
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
628 |
918 | 629 #elif defined(__APPLE__) |
630 ASSERT_EQ(Endianness_Little, Toolbox::DetectEndianness()); | |
631 | |
890 | 632 #elif defined(__linux) || defined(__FreeBSD_kernel__) |
674
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
633 |
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
634 #if !defined(__BYTE_ORDER) |
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
635 # error Support your platform here |
637 | 636 #endif |
637 | |
674
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
638 # if __BYTE_ORDER == __BIG_ENDIAN |
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
639 ASSERT_EQ(Endianness_Big, Toolbox::DetectEndianness()); |
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
640 # else // __LITTLE_ENDIAN |
637 | 641 ASSERT_EQ(Endianness_Little, Toolbox::DetectEndianness()); |
674
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
642 # endif |
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
643 |
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
644 #else |
d76b747aec1b
improved check for big endianness
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
637
diff
changeset
|
645 #error Support your platform here |
637 | 646 #endif |
647 } | |
648 | |
649 | |
0 | 650 int main(int argc, char **argv) |
651 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
652 // Initialize Google's logging library. |
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
653 FLAGS_logtostderr = true; |
137
0e97abc7b950
fix of a bug in older versions of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
107
diff
changeset
|
654 FLAGS_minloglevel = 0; |
159
c08fbad40ddd
less verbosity in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
137
diff
changeset
|
655 |
c08fbad40ddd
less verbosity in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
137
diff
changeset
|
656 // Go to trace-level verbosity |
c08fbad40ddd
less verbosity in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
137
diff
changeset
|
657 //FLAGS_v = 1; |
c08fbad40ddd
less verbosity in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
137
diff
changeset
|
658 |
453 | 659 Toolbox::DetectEndianness(); |
660 | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
661 google::InitGoogleLogging("Orthanc"); |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
662 |
803
4689e400e0fa
directory to store the results of the unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
663 Toolbox::CreateDirectory("UnitTestsResults"); |
4689e400e0fa
directory to store the results of the unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
782
diff
changeset
|
664 |
63 | 665 OrthancInitialize(); |
0 | 666 ::testing::InitGoogleTest(&argc, argv); |
667 int result = RUN_ALL_TESTS(); | |
63 | 668 OrthancFinalize(); |
0 | 669 return result; |
670 } |