comparison OrthancFramework/UnitTestsSources/FrameworkTests.cpp @ 4327:9684a690ca63

fix link errors on wasm unit tests
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 24 Nov 2020 20:53:21 +0100
parents b96aedfa8cc1
children a01b1c9cbef4
comparison
equal deleted inserted replaced
4326:83c5bd439fcc 4327:9684a690ca63
32 #include "../Sources/EnumerationDictionary.h" 32 #include "../Sources/EnumerationDictionary.h"
33 33
34 #include <gtest/gtest.h> 34 #include <gtest/gtest.h>
35 35
36 #include "../Sources/DicomFormat/DicomTag.h" 36 #include "../Sources/DicomFormat/DicomTag.h"
37 #include "../Sources/HttpServer/HttpToolbox.h"
38 #include "../Sources/Logging.h" 37 #include "../Sources/Logging.h"
39 #include "../Sources/OrthancException.h" 38 #include "../Sources/OrthancException.h"
40 #include "../Sources/Toolbox.h" 39 #include "../Sources/Toolbox.h"
41 40
42 #if ORTHANC_SANDBOXED != 1 41 #if ORTHANC_SANDBOXED != 1
43 # include "../Sources/FileBuffer.h" 42 # include "../Sources/FileBuffer.h"
43 # include "../Sources/HttpServer/HttpToolbox.h"
44 # include "../Sources/MetricsRegistry.h" 44 # include "../Sources/MetricsRegistry.h"
45 # include "../Sources/SystemToolbox.h" 45 # include "../Sources/SystemToolbox.h"
46 # include "../Sources/TemporaryFile.h" 46 # include "../Sources/TemporaryFile.h"
47 #endif 47 #endif
48 48
99 99
100 ASSERT_FALSE(Toolbox::IsSHA1("b5ed549f-956400ce-69a8c063-bf5b78be-2732a4b_")); 100 ASSERT_FALSE(Toolbox::IsSHA1("b5ed549f-956400ce-69a8c063-bf5b78be-2732a4b_"));
101 } 101 }
102 102
103 103
104 #if ORTHANC_SANDBOXED != 1
104 TEST(ParseGetArguments, Basic) 105 TEST(ParseGetArguments, Basic)
105 { 106 {
106 IHttpHandler::GetArguments b; 107 IHttpHandler::GetArguments b;
107 HttpToolbox::ParseGetArguments(b, "aaa=baaa&bb=a&aa=c"); 108 HttpToolbox::ParseGetArguments(b, "aaa=baaa&bb=a&aa=c");
108 109
112 ASSERT_EQ(3u, a.size()); 113 ASSERT_EQ(3u, a.size());
113 ASSERT_EQ(a["aaa"], "baaa"); 114 ASSERT_EQ(a["aaa"], "baaa");
114 ASSERT_EQ(a["bb"], "a"); 115 ASSERT_EQ(a["bb"], "a");
115 ASSERT_EQ(a["aa"], "c"); 116 ASSERT_EQ(a["aa"], "c");
116 } 117 }
117 118 #endif
119
120 #if ORTHANC_SANDBOXED != 1
118 TEST(ParseGetArguments, BasicEmpty) 121 TEST(ParseGetArguments, BasicEmpty)
119 { 122 {
120 IHttpHandler::GetArguments b; 123 IHttpHandler::GetArguments b;
121 HttpToolbox::ParseGetArguments(b, "aaa&bb=aa&aa"); 124 HttpToolbox::ParseGetArguments(b, "aaa&bb=aa&aa");
122 125
126 ASSERT_EQ(3u, a.size()); 129 ASSERT_EQ(3u, a.size());
127 ASSERT_EQ(a["aaa"], ""); 130 ASSERT_EQ(a["aaa"], "");
128 ASSERT_EQ(a["bb"], "aa"); 131 ASSERT_EQ(a["bb"], "aa");
129 ASSERT_EQ(a["aa"], ""); 132 ASSERT_EQ(a["aa"], "");
130 } 133 }
131 134 #endif
135
136 #if ORTHANC_SANDBOXED != 1
132 TEST(ParseGetArguments, Single) 137 TEST(ParseGetArguments, Single)
133 { 138 {
134 IHttpHandler::GetArguments b; 139 IHttpHandler::GetArguments b;
135 HttpToolbox::ParseGetArguments(b, "aaa=baaa"); 140 HttpToolbox::ParseGetArguments(b, "aaa=baaa");
136 141
138 HttpToolbox::CompileGetArguments(a, b); 143 HttpToolbox::CompileGetArguments(a, b);
139 144
140 ASSERT_EQ(1u, a.size()); 145 ASSERT_EQ(1u, a.size());
141 ASSERT_EQ(a["aaa"], "baaa"); 146 ASSERT_EQ(a["aaa"], "baaa");
142 } 147 }
143 148 #endif
149
150 #if ORTHANC_SANDBOXED != 1
144 TEST(ParseGetArguments, SingleEmpty) 151 TEST(ParseGetArguments, SingleEmpty)
145 { 152 {
146 IHttpHandler::GetArguments b; 153 IHttpHandler::GetArguments b;
147 HttpToolbox::ParseGetArguments(b, "aaa"); 154 HttpToolbox::ParseGetArguments(b, "aaa");
148 155
150 HttpToolbox::CompileGetArguments(a, b); 157 HttpToolbox::CompileGetArguments(a, b);
151 158
152 ASSERT_EQ(1u, a.size()); 159 ASSERT_EQ(1u, a.size());
153 ASSERT_EQ(a["aaa"], ""); 160 ASSERT_EQ(a["aaa"], "");
154 } 161 }
155 162 #endif
163
164 #if ORTHANC_SANDBOXED != 1
156 TEST(ParseGetQuery, Test1) 165 TEST(ParseGetQuery, Test1)
157 { 166 {
158 UriComponents uri; 167 UriComponents uri;
159 IHttpHandler::GetArguments b; 168 IHttpHandler::GetArguments b;
160 HttpToolbox::ParseGetQuery(uri, b, "/instances/test/world?aaa=baaa&bb=a&aa=c"); 169 HttpToolbox::ParseGetQuery(uri, b, "/instances/test/world?aaa=baaa&bb=a&aa=c");
169 ASSERT_EQ(3u, a.size()); 178 ASSERT_EQ(3u, a.size());
170 ASSERT_EQ(a["aaa"], "baaa"); 179 ASSERT_EQ(a["aaa"], "baaa");
171 ASSERT_EQ(a["bb"], "a"); 180 ASSERT_EQ(a["bb"], "a");
172 ASSERT_EQ(a["aa"], "c"); 181 ASSERT_EQ(a["aa"], "c");
173 } 182 }
174 183 #endif
184
185 #if ORTHANC_SANDBOXED != 1
175 TEST(ParseGetQuery, Test2) 186 TEST(ParseGetQuery, Test2)
176 { 187 {
177 UriComponents uri; 188 UriComponents uri;
178 IHttpHandler::GetArguments b; 189 IHttpHandler::GetArguments b;
179 HttpToolbox::ParseGetQuery(uri, b, "/instances/test/world"); 190 HttpToolbox::ParseGetQuery(uri, b, "/instances/test/world");
185 ASSERT_EQ("instances", uri[0]); 196 ASSERT_EQ("instances", uri[0]);
186 ASSERT_EQ("test", uri[1]); 197 ASSERT_EQ("test", uri[1]);
187 ASSERT_EQ("world", uri[2]); 198 ASSERT_EQ("world", uri[2]);
188 ASSERT_EQ(0u, a.size()); 199 ASSERT_EQ(0u, a.size());
189 } 200 }
201 #endif
190 202
191 TEST(Uri, SplitUriComponents) 203 TEST(Uri, SplitUriComponents)
192 { 204 {
193 UriComponents c, d; 205 UriComponents c, d;
194 Toolbox::SplitUriComponents(c, "/cou/hello/world"); 206 Toolbox::SplitUriComponents(c, "/cou/hello/world");