Mercurial > hg > orthanc
annotate UnitTests/main.cpp @ 338:3a3b3ba8c1e0
fix for uploads through internet explorer 7
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 14 Jan 2013 11:35:01 +0100 |
parents | 26218c4de7e0 |
children | d2c69150a979 |
rev | line source |
---|---|
0 | 1 #include "gtest/gtest.h" |
2 | |
3 #include <ctype.h> | |
4 | |
5 #include "../Core/Compression/ZlibCompressor.h" | |
6 #include "../Core/DicomFormat/DicomTag.h" | |
63 | 7 #include "../OrthancCppClient/HttpClient.h" |
0 | 8 #include "../Core/HttpServer/HttpHandler.h" |
63 | 9 #include "../Core/OrthancException.h" |
0 | 10 #include "../Core/Toolbox.h" |
11 #include "../Core/Uuid.h" | |
63 | 12 #include "../OrthancServer/FromDcmtkBridge.h" |
13 #include "../OrthancServer/OrthancInitialization.h" | |
0 | 14 |
63 | 15 using namespace Orthanc; |
0 | 16 |
17 | |
18 TEST(Uuid, Generation) | |
19 { | |
20 for (int i = 0; i < 10; i++) | |
21 { | |
22 std::string s = Toolbox::GenerateUuid(); | |
23 ASSERT_TRUE(Toolbox::IsUuid(s)); | |
24 } | |
25 } | |
26 | |
27 TEST(Uuid, Test) | |
28 { | |
29 ASSERT_FALSE(Toolbox::IsUuid("")); | |
30 ASSERT_FALSE(Toolbox::IsUuid("012345678901234567890123456789012345")); | |
31 ASSERT_TRUE(Toolbox::IsUuid("550e8400-e29b-41d4-a716-446655440000")); | |
32 } | |
33 | |
34 TEST(Zlib, Basic) | |
35 { | |
36 std::string s = Toolbox::GenerateUuid(); | |
37 s = s + s + s + s; | |
38 | |
39 std::string compressed; | |
40 ZlibCompressor c; | |
41 c.Compress(compressed, s); | |
42 | |
43 std::string uncompressed; | |
44 c.Uncompress(uncompressed, compressed); | |
45 | |
46 ASSERT_EQ(s.size(), uncompressed.size()); | |
47 ASSERT_EQ(0, memcmp(&s[0], &uncompressed[0], s.size())); | |
48 } | |
49 | |
50 TEST(Zlib, Empty) | |
51 { | |
52 std::string s = ""; | |
53 | |
54 std::string compressed; | |
55 ZlibCompressor c; | |
56 c.Compress(compressed, s); | |
57 | |
58 std::string uncompressed; | |
59 c.Uncompress(uncompressed, compressed); | |
60 | |
61 ASSERT_EQ(0u, uncompressed.size()); | |
62 } | |
63 | |
64 TEST(ParseGetQuery, Basic) | |
65 { | |
66 HttpHandler::Arguments a; | |
67 HttpHandler::ParseGetQuery(a, "aaa=baaa&bb=a&aa=c"); | |
68 ASSERT_EQ(3u, a.size()); | |
69 ASSERT_EQ(a["aaa"], "baaa"); | |
70 ASSERT_EQ(a["bb"], "a"); | |
71 ASSERT_EQ(a["aa"], "c"); | |
72 } | |
73 | |
74 TEST(ParseGetQuery, BasicEmpty) | |
75 { | |
76 HttpHandler::Arguments a; | |
77 HttpHandler::ParseGetQuery(a, "aaa&bb=aa&aa"); | |
78 ASSERT_EQ(3u, a.size()); | |
79 ASSERT_EQ(a["aaa"], ""); | |
80 ASSERT_EQ(a["bb"], "aa"); | |
81 ASSERT_EQ(a["aa"], ""); | |
82 } | |
83 | |
84 TEST(ParseGetQuery, Single) | |
85 { | |
86 HttpHandler::Arguments a; | |
87 HttpHandler::ParseGetQuery(a, "aaa=baaa"); | |
88 ASSERT_EQ(1u, a.size()); | |
89 ASSERT_EQ(a["aaa"], "baaa"); | |
90 } | |
91 | |
92 TEST(ParseGetQuery, SingleEmpty) | |
93 { | |
94 HttpHandler::Arguments a; | |
95 HttpHandler::ParseGetQuery(a, "aaa"); | |
96 ASSERT_EQ(1u, a.size()); | |
97 ASSERT_EQ(a["aaa"], ""); | |
98 } | |
99 | |
100 TEST(DicomFormat, Tag) | |
101 { | |
102 ASSERT_EQ("PatientName", FromDcmtkBridge::GetName(DicomTag(0x0010, 0x0010))); | |
103 | |
304 | 104 DicomTag t = FromDcmtkBridge::ParseTag("SeriesDescription"); |
0 | 105 ASSERT_EQ(0x0008, t.GetGroup()); |
106 ASSERT_EQ(0x103E, t.GetElement()); | |
304 | 107 |
108 t = FromDcmtkBridge::ParseTag("0020-e040"); | |
109 ASSERT_EQ(0x0020, t.GetGroup()); | |
110 ASSERT_EQ(0xe040, t.GetElement()); | |
0 | 111 } |
112 | |
113 | |
114 TEST(Uri, SplitUriComponents) | |
115 { | |
116 UriComponents c; | |
117 Toolbox::SplitUriComponents(c, "/cou/hello/world"); | |
118 ASSERT_EQ(3u, c.size()); | |
119 ASSERT_EQ("cou", c[0]); | |
120 ASSERT_EQ("hello", c[1]); | |
121 ASSERT_EQ("world", c[2]); | |
122 | |
123 Toolbox::SplitUriComponents(c, "/cou/hello/world/"); | |
124 ASSERT_EQ(3u, c.size()); | |
125 ASSERT_EQ("cou", c[0]); | |
126 ASSERT_EQ("hello", c[1]); | |
127 ASSERT_EQ("world", c[2]); | |
128 | |
129 Toolbox::SplitUriComponents(c, "/cou/hello/world/a"); | |
130 ASSERT_EQ(4u, c.size()); | |
131 ASSERT_EQ("cou", c[0]); | |
132 ASSERT_EQ("hello", c[1]); | |
133 ASSERT_EQ("world", c[2]); | |
134 ASSERT_EQ("a", c[3]); | |
135 | |
136 Toolbox::SplitUriComponents(c, "/"); | |
137 ASSERT_EQ(0u, c.size()); | |
138 | |
139 Toolbox::SplitUriComponents(c, "/hello"); | |
140 ASSERT_EQ(1u, c.size()); | |
141 ASSERT_EQ("hello", c[0]); | |
142 | |
143 Toolbox::SplitUriComponents(c, "/hello/"); | |
144 ASSERT_EQ(1u, c.size()); | |
145 ASSERT_EQ("hello", c[0]); | |
146 | |
63 | 147 ASSERT_THROW(Toolbox::SplitUriComponents(c, ""), OrthancException); |
148 ASSERT_THROW(Toolbox::SplitUriComponents(c, "a"), OrthancException); | |
207 | 149 ASSERT_THROW(Toolbox::SplitUriComponents(c, "/coucou//coucou"), OrthancException); |
0 | 150 } |
151 | |
152 | |
153 TEST(Uri, Child) | |
154 { | |
155 UriComponents c1; Toolbox::SplitUriComponents(c1, "/hello/world"); | |
156 UriComponents c2; Toolbox::SplitUriComponents(c2, "/hello/hello"); | |
157 UriComponents c3; Toolbox::SplitUriComponents(c3, "/hello"); | |
158 UriComponents c4; Toolbox::SplitUriComponents(c4, "/world"); | |
159 UriComponents c5; Toolbox::SplitUriComponents(c5, "/"); | |
160 | |
161 ASSERT_TRUE(Toolbox::IsChildUri(c1, c1)); | |
162 ASSERT_FALSE(Toolbox::IsChildUri(c1, c2)); | |
163 ASSERT_FALSE(Toolbox::IsChildUri(c1, c3)); | |
164 ASSERT_FALSE(Toolbox::IsChildUri(c1, c4)); | |
165 ASSERT_FALSE(Toolbox::IsChildUri(c1, c5)); | |
166 | |
167 ASSERT_FALSE(Toolbox::IsChildUri(c2, c1)); | |
168 ASSERT_TRUE(Toolbox::IsChildUri(c2, c2)); | |
169 ASSERT_FALSE(Toolbox::IsChildUri(c2, c3)); | |
170 ASSERT_FALSE(Toolbox::IsChildUri(c2, c4)); | |
171 ASSERT_FALSE(Toolbox::IsChildUri(c2, c5)); | |
172 | |
173 ASSERT_TRUE(Toolbox::IsChildUri(c3, c1)); | |
174 ASSERT_TRUE(Toolbox::IsChildUri(c3, c2)); | |
175 ASSERT_TRUE(Toolbox::IsChildUri(c3, c3)); | |
176 ASSERT_FALSE(Toolbox::IsChildUri(c3, c4)); | |
177 ASSERT_FALSE(Toolbox::IsChildUri(c3, c5)); | |
178 | |
179 ASSERT_FALSE(Toolbox::IsChildUri(c4, c1)); | |
180 ASSERT_FALSE(Toolbox::IsChildUri(c4, c2)); | |
181 ASSERT_FALSE(Toolbox::IsChildUri(c4, c3)); | |
182 ASSERT_TRUE(Toolbox::IsChildUri(c4, c4)); | |
183 ASSERT_FALSE(Toolbox::IsChildUri(c4, c5)); | |
184 | |
185 ASSERT_TRUE(Toolbox::IsChildUri(c5, c1)); | |
186 ASSERT_TRUE(Toolbox::IsChildUri(c5, c2)); | |
187 ASSERT_TRUE(Toolbox::IsChildUri(c5, c3)); | |
188 ASSERT_TRUE(Toolbox::IsChildUri(c5, c4)); | |
189 ASSERT_TRUE(Toolbox::IsChildUri(c5, c5)); | |
190 } | |
191 | |
192 TEST(Uri, AutodetectMimeType) | |
193 { | |
194 ASSERT_EQ("", Toolbox::AutodetectMimeType("../NOTES")); | |
195 ASSERT_EQ("", Toolbox::AutodetectMimeType("")); | |
196 ASSERT_EQ("", Toolbox::AutodetectMimeType("/")); | |
197 ASSERT_EQ("", Toolbox::AutodetectMimeType("a/a")); | |
198 | |
199 ASSERT_EQ("text/plain", Toolbox::AutodetectMimeType("../NOTES.txt")); | |
200 ASSERT_EQ("text/plain", Toolbox::AutodetectMimeType("../coucou.xml/NOTES.txt")); | |
201 ASSERT_EQ("text/xml", Toolbox::AutodetectMimeType("../.xml")); | |
202 | |
203 ASSERT_EQ("application/javascript", Toolbox::AutodetectMimeType("NOTES.js")); | |
204 ASSERT_EQ("application/json", Toolbox::AutodetectMimeType("NOTES.json")); | |
205 ASSERT_EQ("application/pdf", Toolbox::AutodetectMimeType("NOTES.pdf")); | |
206 ASSERT_EQ("text/css", Toolbox::AutodetectMimeType("NOTES.css")); | |
207 ASSERT_EQ("text/html", Toolbox::AutodetectMimeType("NOTES.html")); | |
208 ASSERT_EQ("text/plain", Toolbox::AutodetectMimeType("NOTES.txt")); | |
209 ASSERT_EQ("text/xml", Toolbox::AutodetectMimeType("NOTES.xml")); | |
210 ASSERT_EQ("image/gif", Toolbox::AutodetectMimeType("NOTES.gif")); | |
211 ASSERT_EQ("image/jpeg", Toolbox::AutodetectMimeType("NOTES.jpg")); | |
212 ASSERT_EQ("image/jpeg", Toolbox::AutodetectMimeType("NOTES.jpeg")); | |
213 ASSERT_EQ("image/png", Toolbox::AutodetectMimeType("NOTES.png")); | |
214 } | |
215 | |
22 | 216 TEST(Toolbox, ComputeMD5) |
217 { | |
218 std::string s; | |
219 | |
220 // # echo -n "Hello" | md5sum | |
221 | |
222 Toolbox::ComputeMD5(s, "Hello"); | |
223 ASSERT_EQ("8b1a9953c4611296a827abf8c47804d7", s); | |
224 Toolbox::ComputeMD5(s, ""); | |
225 ASSERT_EQ("d41d8cd98f00b204e9800998ecf8427e", s); | |
226 } | |
227 | |
177 | 228 TEST(Toolbox, ComputeSHA1) |
229 { | |
230 std::string s; | |
231 | |
232 Toolbox::ComputeSHA1(s, "The quick brown fox jumps over the lazy dog"); | |
233 ASSERT_EQ("2fd4e1c6-7a2d28fc-ed849ee1-bb76e739-1b93eb12", s); | |
234 Toolbox::ComputeSHA1(s, ""); | |
235 ASSERT_EQ("da39a3ee-5e6b4b0d-3255bfef-95601890-afd80709", s); | |
236 } | |
237 | |
238 | |
24 | 239 TEST(Toolbox, Base64) |
240 { | |
241 ASSERT_EQ("", Toolbox::EncodeBase64("")); | |
242 ASSERT_EQ("YQ==", Toolbox::EncodeBase64("a")); | |
243 ASSERT_EQ("SGVsbG8gd29ybGQ=", Toolbox::EncodeBase64("Hello world")); | |
244 } | |
245 | |
87
8517e2c44283
path to configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
246 TEST(Toolbox, PathToExecutable) |
8517e2c44283
path to configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
247 { |
8517e2c44283
path to configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
248 printf("[%s]\n", Toolbox::GetPathToExecutable().c_str()); |
8517e2c44283
path to configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
249 printf("[%s]\n", Toolbox::GetDirectoryOfExecutable().c_str()); |
8517e2c44283
path to configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
250 } |
8517e2c44283
path to configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
251 |
247
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
235
diff
changeset
|
252 TEST(Toolbox, StripSpaces) |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
235
diff
changeset
|
253 { |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
235
diff
changeset
|
254 ASSERT_EQ("", Toolbox::StripSpaces(" \t \r \n ")); |
c9b3ba0fd140
path management in zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
235
diff
changeset
|
255 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
|
256 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
|
257 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
|
258 } |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
259 |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
260 |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
261 #include <glog/logging.h> |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
262 |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
263 TEST(Logger, Basic) |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
264 { |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
265 LOG(INFO) << "I say hello"; |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
266 } |
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
267 |
107
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
268 TEST(Toolbox, ConvertFromLatin1) |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
269 { |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
270 // 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
|
271 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
|
272 |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
273 /*FILE* f = fopen("/tmp/tutu", "w"); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
274 fwrite(&data[0], 9, 1, f); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
275 fclose(f);*/ |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
276 |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
277 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
|
278 ASSERT_EQ("&abc", Toolbox::ConvertToAscii(s)); |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
279 |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
280 // Open in Emacs, then save with UTF-8 encoding, then "hexdump -C" |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
281 std::string utf8 = Toolbox::ConvertToUtf8(s, "ISO-8859-1"); |
235 | 282 ASSERT_EQ(15u, utf8.size()); |
107
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
283 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
|
284 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
|
285 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
|
286 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
|
287 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
|
288 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
|
289 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
|
290 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
|
291 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
|
292 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
|
293 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
|
294 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
|
295 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
|
296 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
|
297 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
|
298 } |
3b45473c0a73
replace boost::locale with iconv for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
102
diff
changeset
|
299 |
336 | 300 TEST(Toolbox, UrlDecode) |
301 { | |
302 std::string s; | |
303 | |
304 s = "Hello%20World"; | |
305 Toolbox::UrlDecode(s); | |
306 ASSERT_EQ("Hello World", s); | |
307 | |
337 | 308 s = "%21%23%24%26%27%28%29%2A%2B%2c%2f%3A%3b%3d%3f%40%5B%5D%90%ff"; |
336 | 309 Toolbox::UrlDecode(s); |
337 | 310 std::string ss = "!#$&'()*+,/:;=?@[]"; |
311 ss.push_back((char) 144); | |
312 ss.push_back((char) 255); | |
313 ASSERT_EQ(ss, s); | |
336 | 314 |
315 s = "(2000%2C00A4)+Other"; | |
316 Toolbox::UrlDecode(s); | |
317 ASSERT_EQ("(2000,00A4) Other", s); | |
318 } | |
319 | |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
320 |
0 | 321 int main(int argc, char **argv) |
322 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
323 // Initialize Google's logging library. |
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
324 FLAGS_logtostderr = true; |
137
0e97abc7b950
fix of a bug in older versions of sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
107
diff
changeset
|
325 FLAGS_minloglevel = 0; |
159
c08fbad40ddd
less verbosity in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
137
diff
changeset
|
326 |
c08fbad40ddd
less verbosity in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
137
diff
changeset
|
327 // Go to trace-level verbosity |
c08fbad40ddd
less verbosity in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
137
diff
changeset
|
328 //FLAGS_v = 1; |
c08fbad40ddd
less verbosity in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
137
diff
changeset
|
329 |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
330 google::InitGoogleLogging("Orthanc"); |
100
27dc762e3dc8
getting rid of static dcmtk for debian
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
331 |
63 | 332 OrthancInitialize(); |
0 | 333 ::testing::InitGoogleTest(&argc, argv); |
334 int result = RUN_ALL_TESTS(); | |
63 | 335 OrthancFinalize(); |
0 | 336 return result; |
337 } |