| 1 |
// Tencent is pleased to support the open source community by making RapidJSON available. |
| 2 |
// |
| 3 |
// (C) Copyright IBM Corporation 2021 |
| 4 |
// |
| 5 |
// Licensed under the MIT License (the "License"); you may not use this file except |
| 6 |
// in compliance with the License. You may obtain a copy of the License at |
| 7 |
// |
| 8 |
// http://opensource.org/licenses/MIT |
| 9 |
// |
| 10 |
// Unless required by applicable law or agreed to in writing, software distributed |
| 11 |
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 12 |
// CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 13 |
// specific language governing permissions and limitations under the License. |
| 14 |
|
| 15 |
#define RAPIDJSON_SCHEMA_VERBOSE 0 |
| 16 |
#define RAPIDJSON_HAS_STDSTRING 1 |
| 17 |
|
| 18 |
#include "unittest.h" |
| 19 |
#include "rapidjson/document.h" |
| 20 |
#include "rapidjson/uri.h" |
| 21 |
|
| 22 |
#ifdef __clang__ |
| 23 |
RAPIDJSON_DIAG_PUSH |
| 24 |
RAPIDJSON_DIAG_OFF(variadic-macros) |
| 25 |
#elif defined(_MSC_VER) |
| 26 |
RAPIDJSON_DIAG_PUSH |
| 27 |
RAPIDJSON_DIAG_OFF(4822) // local class member function does not have a body |
| 28 |
#endif |
| 29 |
|
| 30 |
using namespace rapidjson; |
| 31 |
|
| 32 |
TEST(Uri, DefaultConstructor) { |
| 33 |
typedef GenericUri<Value> UriType; |
| 34 |
UriType u; |
| 35 |
EXPECT_TRUE(u.GetSchemeString() == 0); |
| 36 |
EXPECT_TRUE(u.GetAuthString() == 0); |
| 37 |
EXPECT_TRUE(u.GetPathString() == 0); |
| 38 |
EXPECT_TRUE(u.GetBaseString() == 0); |
| 39 |
EXPECT_TRUE(u.GetQueryString() == 0); |
| 40 |
EXPECT_TRUE(u.GetFragString() == 0); |
| 41 |
EXPECT_TRUE(u.GetString() == 0); |
| 42 |
EXPECT_TRUE(u.GetSchemeStringLength() == 0); |
| 43 |
EXPECT_TRUE(u.GetAuthStringLength() == 0); |
| 44 |
EXPECT_TRUE(u.GetPathStringLength() == 0); |
| 45 |
EXPECT_TRUE(u.GetBaseStringLength() == 0); |
| 46 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 47 |
EXPECT_TRUE(u.GetFragStringLength() == 0); |
| 48 |
EXPECT_TRUE(u.GetStringLength() == 0); |
| 49 |
} |
| 50 |
|
| 51 |
TEST(Uri, Parse) { |
| 52 |
typedef GenericUri<Value, MemoryPoolAllocator<> > UriType; |
| 53 |
MemoryPoolAllocator<CrtAllocator> allocator; |
| 54 |
Value v; |
| 55 |
Value w; |
| 56 |
|
| 57 |
v.SetString("http://auth/path/xxx?query#frag", allocator); |
| 58 |
UriType u = UriType(v, &allocator); |
| 59 |
EXPECT_TRUE(StrCmp(u.GetSchemeString(), "http:") == 0); |
| 60 |
EXPECT_TRUE(StrCmp(u.GetAuthString(), "//auth") == 0); |
| 61 |
EXPECT_TRUE(StrCmp(u.GetPathString(), "/path/xxx") == 0); |
| 62 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), "http://auth/path/xxx?query") == 0); |
| 63 |
EXPECT_TRUE(StrCmp(u.GetQueryString(), "?query") == 0); |
| 64 |
EXPECT_TRUE(StrCmp(u.GetFragString(), "#frag") == 0); |
| 65 |
u.Get(w, allocator); |
| 66 |
EXPECT_TRUE(*w.GetString() == *v.GetString()); |
| 67 |
|
| 68 |
v.SetString("urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f", allocator); |
| 69 |
u = UriType(v, &allocator); |
| 70 |
EXPECT_TRUE(StrCmp(u.GetSchemeString(), "urn:") == 0); |
| 71 |
EXPECT_TRUE(u.GetAuthStringLength() == 0); |
| 72 |
EXPECT_TRUE(StrCmp(u.GetPathString(), "uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f") == 0); |
| 73 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f") == 0); |
| 74 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 75 |
EXPECT_TRUE(u.GetFragStringLength() == 0); |
| 76 |
u.Get(w, allocator); |
| 77 |
EXPECT_TRUE(*w.GetString() == *v.GetString()); |
| 78 |
|
| 79 |
v.SetString("", allocator); |
| 80 |
u = UriType(v, &allocator); |
| 81 |
EXPECT_TRUE(u.GetSchemeStringLength() == 0); |
| 82 |
EXPECT_TRUE(u.GetAuthStringLength() == 0); |
| 83 |
EXPECT_TRUE(u.GetPathStringLength() == 0); |
| 84 |
EXPECT_TRUE(u.GetBaseStringLength() == 0); |
| 85 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 86 |
EXPECT_TRUE(u.GetFragStringLength() == 0); |
| 87 |
|
| 88 |
v.SetString("http://auth/", allocator); |
| 89 |
u = UriType(v, &allocator); |
| 90 |
EXPECT_TRUE(StrCmp(u.GetSchemeString(), "http:") == 0); |
| 91 |
EXPECT_TRUE(StrCmp(u.GetAuthString(), "//auth") == 0); |
| 92 |
EXPECT_TRUE(StrCmp(u.GetPathString(), "/") == 0); |
| 93 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), "http://auth/") == 0); |
| 94 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 95 |
EXPECT_TRUE(u.GetFragStringLength() == 0); |
| 96 |
|
| 97 |
u = UriType("/path/sub"); |
| 98 |
EXPECT_TRUE(u.GetSchemeStringLength() == 0); |
| 99 |
EXPECT_TRUE(u.GetAuthStringLength() == 0); |
| 100 |
EXPECT_TRUE(StrCmp(u.GetPathString(), "/path/sub") == 0); |
| 101 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), "/path/sub") == 0); |
| 102 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 103 |
EXPECT_TRUE(u.GetFragStringLength() == 0); |
| 104 |
|
| 105 |
// absolute path gets normalized |
| 106 |
u = UriType("/path/../sub/"); |
| 107 |
EXPECT_TRUE(u.GetSchemeStringLength() == 0); |
| 108 |
EXPECT_TRUE(u.GetAuthStringLength() == 0); |
| 109 |
EXPECT_TRUE(StrCmp(u.GetPathString(), "/sub/") == 0); |
| 110 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), "/sub/") == 0); |
| 111 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 112 |
EXPECT_TRUE(u.GetFragStringLength() == 0); |
| 113 |
|
| 114 |
// relative path does not |
| 115 |
u = UriType("path/../sub"); |
| 116 |
EXPECT_TRUE(u.GetSchemeStringLength() == 0); |
| 117 |
EXPECT_TRUE(u.GetAuthStringLength() == 0); |
| 118 |
EXPECT_TRUE(StrCmp(u.GetPathString(), "path/../sub") == 0); |
| 119 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), "path/../sub") == 0); |
| 120 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 121 |
EXPECT_TRUE(u.GetFragStringLength() == 0); |
| 122 |
|
| 123 |
u = UriType("http://auth#frag/stuff"); |
| 124 |
EXPECT_TRUE(StrCmp(u.GetSchemeString(), "http:") == 0); |
| 125 |
EXPECT_TRUE(StrCmp(u.GetAuthString(), "//auth") == 0); |
| 126 |
EXPECT_TRUE(u.GetPathStringLength() == 0); |
| 127 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), "http://auth") == 0); |
| 128 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 129 |
EXPECT_TRUE(StrCmp(u.GetFragString(), "#frag/stuff") == 0); |
| 130 |
EXPECT_TRUE(StrCmp(u.GetString(), "http://auth#frag/stuff") == 0); |
| 131 |
|
| 132 |
const Value::Ch c[] = { '#', 'f', 'r', 'a', 'g', '/', 's', 't', 'u', 'f', 'f', '\0'}; |
| 133 |
SizeType len = internal::StrLen<Value::Ch>(c); |
| 134 |
u = UriType(c, len); |
| 135 |
EXPECT_TRUE(StrCmp(u.GetString(), "#frag/stuff") == 0); |
| 136 |
EXPECT_TRUE(u.GetStringLength() == len); |
| 137 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), "") == 0); |
| 138 |
EXPECT_TRUE(u.GetBaseStringLength() == 0); |
| 139 |
EXPECT_TRUE(StrCmp(u.GetFragString(), "#frag/stuff") == 0); |
| 140 |
EXPECT_TRUE(u.GetFragStringLength() == len); |
| 141 |
|
| 142 |
u = UriType(c); |
| 143 |
EXPECT_TRUE(StrCmp(u.GetString(), "#frag/stuff") == 0); |
| 144 |
EXPECT_TRUE(u.GetStringLength() == len); |
| 145 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), "") == 0); |
| 146 |
EXPECT_TRUE(u.GetBaseStringLength() == 0); |
| 147 |
EXPECT_TRUE(StrCmp(u.GetFragString(), "#frag/stuff") == 0); |
| 148 |
EXPECT_TRUE(u.GetFragStringLength() == len); |
| 149 |
|
| 150 |
// Incomplete auth treated as path |
| 151 |
u = UriType("http:/"); |
| 152 |
EXPECT_TRUE(StrCmp(u.GetSchemeString(), "http:") == 0); |
| 153 |
EXPECT_TRUE(u.GetAuthStringLength() == 0); |
| 154 |
EXPECT_TRUE(StrCmp(u.GetPathString(), "/") == 0); |
| 155 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), "http:/") == 0); |
| 156 |
} |
| 157 |
|
| 158 |
TEST(Uri, Parse_UTF16) { |
| 159 |
typedef GenericValue<UTF16<> > Value16; |
| 160 |
typedef GenericUri<Value16, MemoryPoolAllocator<> > UriType; |
| 161 |
MemoryPoolAllocator<CrtAllocator> allocator; |
| 162 |
Value16 v; |
| 163 |
Value16 w; |
| 164 |
|
| 165 |
v.SetString(L"http://auth/path/xxx?query#frag", allocator); |
| 166 |
UriType u = UriType(v, &allocator); |
| 167 |
EXPECT_TRUE(StrCmp(u.GetSchemeString(), L"http:") == 0); |
| 168 |
EXPECT_TRUE(StrCmp(u.GetAuthString(), L"//auth") == 0); |
| 169 |
EXPECT_TRUE(StrCmp(u.GetPathString(), L"/path/xxx") == 0); |
| 170 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), L"http://auth/path/xxx?query") == 0); |
| 171 |
EXPECT_TRUE(StrCmp(u.GetQueryString(), L"?query") == 0); |
| 172 |
EXPECT_TRUE(StrCmp(u.GetFragString(), L"#frag") == 0); |
| 173 |
u.Get(w, allocator); |
| 174 |
EXPECT_TRUE(*w.GetString() == *v.GetString()); |
| 175 |
|
| 176 |
v.SetString(L"urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f", allocator); |
| 177 |
u = UriType(v, &allocator); |
| 178 |
EXPECT_TRUE(StrCmp(u.GetSchemeString(), L"urn:") == 0); |
| 179 |
EXPECT_TRUE(u.GetAuthStringLength() == 0); |
| 180 |
EXPECT_TRUE(StrCmp(u.GetPathString(), L"uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f") == 0); |
| 181 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), L"urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f") == 0); |
| 182 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 183 |
EXPECT_TRUE(u.GetFragStringLength() == 0); |
| 184 |
u.Get(w, allocator); |
| 185 |
EXPECT_TRUE(*w.GetString() == *v.GetString()); |
| 186 |
|
| 187 |
v.SetString(L"", allocator); |
| 188 |
u = UriType(v, &allocator); |
| 189 |
EXPECT_TRUE(u.GetSchemeStringLength() == 0); |
| 190 |
EXPECT_TRUE(u.GetAuthStringLength() == 0); |
| 191 |
EXPECT_TRUE(u.GetPathStringLength() == 0); |
| 192 |
EXPECT_TRUE(u.GetBaseStringLength() == 0); |
| 193 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 194 |
EXPECT_TRUE(u.GetFragStringLength() == 0); |
| 195 |
|
| 196 |
v.SetString(L"http://auth/", allocator); |
| 197 |
u = UriType(v, &allocator); |
| 198 |
EXPECT_TRUE(StrCmp(u.GetSchemeString(), L"http:") == 0); |
| 199 |
EXPECT_TRUE(StrCmp(u.GetAuthString(), L"//auth") == 0); |
| 200 |
EXPECT_TRUE(StrCmp(u.GetPathString(), L"/") == 0); |
| 201 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), L"http://auth/") == 0); |
| 202 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 203 |
EXPECT_TRUE(u.GetFragStringLength() == 0); |
| 204 |
|
| 205 |
u = UriType(L"/path/sub"); |
| 206 |
EXPECT_TRUE(u.GetSchemeStringLength() == 0); |
| 207 |
EXPECT_TRUE(u.GetAuthStringLength() == 0); |
| 208 |
EXPECT_TRUE(StrCmp(u.GetPathString(), L"/path/sub") == 0); |
| 209 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), L"/path/sub") == 0); |
| 210 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 211 |
EXPECT_TRUE(u.GetFragStringLength() == 0); |
| 212 |
|
| 213 |
// absolute path gets normalized |
| 214 |
u = UriType(L"/path/../sub/"); |
| 215 |
EXPECT_TRUE(u.GetSchemeStringLength() == 0); |
| 216 |
EXPECT_TRUE(u.GetAuthStringLength() == 0); |
| 217 |
EXPECT_TRUE(StrCmp(u.GetPathString(), L"/sub/") == 0); |
| 218 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), L"/sub/") == 0); |
| 219 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 220 |
EXPECT_TRUE(u.GetFragStringLength() == 0); |
| 221 |
|
| 222 |
// relative path does not |
| 223 |
u = UriType(L"path/../sub"); |
| 224 |
EXPECT_TRUE(u.GetSchemeStringLength() == 0); |
| 225 |
EXPECT_TRUE(u.GetAuthStringLength() == 0); |
| 226 |
EXPECT_TRUE(StrCmp(u.GetPathString(), L"path/../sub") == 0); |
| 227 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), L"path/../sub") == 0); |
| 228 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 229 |
EXPECT_TRUE(u.GetFragStringLength() == 0); |
| 230 |
|
| 231 |
u = UriType(L"http://auth#frag/stuff"); |
| 232 |
EXPECT_TRUE(StrCmp(u.GetSchemeString(), L"http:") == 0); |
| 233 |
EXPECT_TRUE(StrCmp(u.GetAuthString(), L"//auth") == 0); |
| 234 |
EXPECT_TRUE(u.GetPathStringLength() == 0); |
| 235 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), L"http://auth") == 0); |
| 236 |
EXPECT_TRUE(u.GetQueryStringLength() == 0); |
| 237 |
EXPECT_TRUE(StrCmp(u.GetFragString(), L"#frag/stuff") == 0); |
| 238 |
EXPECT_TRUE(StrCmp(u.GetString(), L"http://auth#frag/stuff") == 0); |
| 239 |
|
| 240 |
const Value16::Ch c[] = { '#', 'f', 'r', 'a', 'g', '/', 's', 't', 'u', 'f', 'f', '\0'}; |
| 241 |
SizeType len = internal::StrLen<Value16::Ch>(c); |
| 242 |
u = UriType(c, len); |
| 243 |
EXPECT_TRUE(StrCmp(u.GetString(), L"#frag/stuff") == 0); |
| 244 |
EXPECT_TRUE(u.GetStringLength() == len); |
| 245 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), L"") == 0); |
| 246 |
EXPECT_TRUE(u.GetBaseStringLength() == 0); |
| 247 |
EXPECT_TRUE(StrCmp(u.GetFragString(), L"#frag/stuff") == 0); |
| 248 |
EXPECT_TRUE(u.GetFragStringLength() == len); |
| 249 |
|
| 250 |
u = UriType(c); |
| 251 |
EXPECT_TRUE(StrCmp(u.GetString(), L"#frag/stuff") == 0); |
| 252 |
EXPECT_TRUE(u.GetStringLength() == len); |
| 253 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), L"") == 0); |
| 254 |
EXPECT_TRUE(u.GetBaseStringLength() == 0); |
| 255 |
EXPECT_TRUE(StrCmp(u.GetFragString(), L"#frag/stuff") == 0); |
| 256 |
EXPECT_TRUE(u.GetFragStringLength() == len); |
| 257 |
|
| 258 |
// Incomplete auth treated as path |
| 259 |
u = UriType(L"http:/"); |
| 260 |
EXPECT_TRUE(StrCmp(u.GetSchemeString(), L"http:") == 0); |
| 261 |
EXPECT_TRUE(u.GetAuthStringLength() == 0); |
| 262 |
EXPECT_TRUE(StrCmp(u.GetPathString(), L"/") == 0); |
| 263 |
EXPECT_TRUE(StrCmp(u.GetBaseString(), L"http:/") == 0); |
| 264 |
} |
| 265 |
|
| 266 |
#if RAPIDJSON_HAS_STDSTRING |
| 267 |
TEST(Uri, Parse_Std) { |
| 268 |
typedef GenericUri<Value, MemoryPoolAllocator<> > UriType; |
| 269 |
MemoryPoolAllocator<CrtAllocator> allocator; |
| 270 |
typedef std::basic_string<Value::Ch> String; |
| 271 |
|
| 272 |
String str = "http://auth/path/xxx?query#frag"; |
| 273 |
const UriType uri = UriType(str, &allocator); |
| 274 |
EXPECT_TRUE(UriType::GetScheme(uri) == "http:"); |
| 275 |
EXPECT_TRUE(UriType::GetAuth(uri) == "//auth"); |
| 276 |
EXPECT_TRUE(UriType::GetPath(uri) == "/path/xxx"); |
| 277 |
EXPECT_TRUE(UriType::GetBase(uri) == "http://auth/path/xxx?query"); |
| 278 |
EXPECT_TRUE(UriType::GetQuery(uri) == "?query"); |
| 279 |
EXPECT_TRUE(UriType::GetFrag(uri) == "#frag"); |
| 280 |
EXPECT_TRUE(UriType::Get(uri) == str); |
| 281 |
} |
| 282 |
|
| 283 |
TEST(Uri, Parse_UTF16_Std) { |
| 284 |
typedef GenericValue<UTF16<> > Value16; |
| 285 |
typedef GenericUri<Value16, MemoryPoolAllocator<> > UriType; |
| 286 |
MemoryPoolAllocator<CrtAllocator> allocator; |
| 287 |
typedef std::basic_string<Value16::Ch> String; |
| 288 |
|
| 289 |
String str = L"http://auth/path/xxx?query#frag"; |
| 290 |
const UriType uri = UriType(str, &allocator); |
| 291 |
EXPECT_TRUE(UriType::GetScheme(uri) == L"http:"); |
| 292 |
EXPECT_TRUE(UriType::GetAuth(uri) == L"//auth"); |
| 293 |
EXPECT_TRUE(UriType::GetPath(uri) == L"/path/xxx"); |
| 294 |
EXPECT_TRUE(UriType::GetBase(uri) == L"http://auth/path/xxx?query"); |
| 295 |
EXPECT_TRUE(UriType::GetQuery(uri) == L"?query"); |
| 296 |
EXPECT_TRUE(UriType::GetFrag(uri) == L"#frag"); |
| 297 |
EXPECT_TRUE(UriType::Get(uri) == str); |
| 298 |
} |
| 299 |
#endif |
| 300 |
|
| 301 |
TEST(Uri, CopyConstructor) { |
| 302 |
typedef GenericUri<Value> UriType; |
| 303 |
CrtAllocator allocator; |
| 304 |
|
| 305 |
UriType u("http://auth/path/xxx?query#frag", &allocator); |
| 306 |
UriType u2(u); |
| 307 |
EXPECT_TRUE(u == u2); |
| 308 |
EXPECT_NE(&u.GetAllocator(), &u2.GetAllocator()); |
| 309 |
} |
| 310 |
|
| 311 |
TEST(Uri, Assignment) { |
| 312 |
typedef GenericUri<Value> UriType; |
| 313 |
CrtAllocator allocator; |
| 314 |
|
| 315 |
UriType u("http://auth/path/xxx?query#frag", &allocator); |
| 316 |
UriType u2; |
| 317 |
u2 = u; |
| 318 |
EXPECT_TRUE(u == u2); |
| 319 |
EXPECT_NE(&u.GetAllocator(), &u2.GetAllocator()); |
| 320 |
} |
| 321 |
|
| 322 |
TEST(Uri, Resolve) { |
| 323 |
typedef GenericUri<Value> UriType; |
| 324 |
CrtAllocator allocator; |
| 325 |
|
| 326 |
// ref is full uri |
| 327 |
UriType base = UriType("http://auth/path/#frag"); |
| 328 |
UriType ref = UriType("http://newauth/newpath#newfrag"); |
| 329 |
UriType res = ref.Resolve(base); |
| 330 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://newauth/newpath#newfrag") == 0); |
| 331 |
|
| 332 |
base = UriType("/path/#frag", &allocator); |
| 333 |
ref = UriType("http://newauth/newpath#newfrag", &allocator); |
| 334 |
res = ref.Resolve(base, &allocator); |
| 335 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://newauth/newpath#newfrag") == 0); |
| 336 |
|
| 337 |
// ref is alternate uri |
| 338 |
base = UriType("http://auth/path/#frag"); |
| 339 |
ref = UriType("urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f"); |
| 340 |
res = ref.Resolve(base); |
| 341 |
EXPECT_TRUE(StrCmp(res.GetString(), "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f") == 0); |
| 342 |
|
| 343 |
// ref is absolute path |
| 344 |
base = UriType("http://auth/path/#"); |
| 345 |
ref = UriType("/newpath#newfrag"); |
| 346 |
res = ref.Resolve(base); |
| 347 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://auth/newpath#newfrag") == 0); |
| 348 |
|
| 349 |
// ref is relative path |
| 350 |
base = UriType("http://auth/path/file.json#frag"); |
| 351 |
ref = UriType("newfile.json#"); |
| 352 |
res = ref.Resolve(base); |
| 353 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://auth/path/newfile.json#") == 0); |
| 354 |
|
| 355 |
base = UriType("http://auth/path/file.json#frag/stuff"); |
| 356 |
ref = UriType("newfile.json#newfrag/newstuff"); |
| 357 |
res = ref.Resolve(base); |
| 358 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://auth/path/newfile.json#newfrag/newstuff") == 0); |
| 359 |
|
| 360 |
base = UriType("file.json", &allocator); |
| 361 |
ref = UriType("newfile.json", &base.GetAllocator()); |
| 362 |
res = ref.Resolve(base, &ref.GetAllocator()); |
| 363 |
EXPECT_TRUE(StrCmp(res.GetString(), "newfile.json") == 0); |
| 364 |
|
| 365 |
base = UriType("file.json", &allocator); |
| 366 |
ref = UriType("./newfile.json", &allocator); |
| 367 |
res = ref.Resolve(base, &allocator); |
| 368 |
EXPECT_TRUE(StrCmp(res.GetString(), "newfile.json") == 0); |
| 369 |
|
| 370 |
base = UriType("file.json"); |
| 371 |
ref = UriType("parent/../newfile.json"); |
| 372 |
res = ref.Resolve(base); |
| 373 |
EXPECT_TRUE(StrCmp(res.GetString(), "newfile.json") == 0); |
| 374 |
|
| 375 |
base = UriType("file.json"); |
| 376 |
ref = UriType("parent/./newfile.json"); |
| 377 |
res = ref.Resolve(base); |
| 378 |
EXPECT_TRUE(StrCmp(res.GetString(), "parent/newfile.json") == 0); |
| 379 |
|
| 380 |
base = UriType("file.json"); |
| 381 |
ref = UriType("../../parent/.././newfile.json"); |
| 382 |
res = ref.Resolve(base); |
| 383 |
EXPECT_TRUE(StrCmp(res.GetString(), "newfile.json") == 0); |
| 384 |
|
| 385 |
// This adds a joining slash so resolved length is base length + ref length + 1 |
| 386 |
base = UriType("http://auth"); |
| 387 |
ref = UriType("newfile.json"); |
| 388 |
res = ref.Resolve(base); |
| 389 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://auth/newfile.json") == 0); |
| 390 |
|
| 391 |
// ref is fragment |
| 392 |
base = UriType("#frag/stuff"); |
| 393 |
ref = UriType("#newfrag/newstuff"); |
| 394 |
res = ref.Resolve(base); |
| 395 |
EXPECT_TRUE(StrCmp(res.GetString(), "#newfrag/newstuff") == 0); |
| 396 |
|
| 397 |
// test ref fragment always wins |
| 398 |
base = UriType("/path#frag"); |
| 399 |
ref = UriType(""); |
| 400 |
res = ref.Resolve(base); |
| 401 |
EXPECT_TRUE(StrCmp(res.GetString(), "/path") == 0); |
| 402 |
|
| 403 |
// Examples from RFC3896 |
| 404 |
base = UriType("http://a/b/c/d;p?q"); |
| 405 |
ref = UriType("g:h"); |
| 406 |
res = ref.Resolve(base); |
| 407 |
EXPECT_TRUE(StrCmp(res.GetString(), "g:h") == 0); |
| 408 |
ref = UriType("g"); |
| 409 |
res = ref.Resolve(base); |
| 410 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/g") == 0); |
| 411 |
ref = UriType("./g"); |
| 412 |
res = ref.Resolve(base); |
| 413 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/g") == 0); |
| 414 |
ref = UriType("g/"); |
| 415 |
res = ref.Resolve(base); |
| 416 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/g/") == 0); |
| 417 |
ref = UriType("/g"); |
| 418 |
res = ref.Resolve(base); |
| 419 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/g") == 0); |
| 420 |
ref = UriType("//g"); |
| 421 |
res = ref.Resolve(base); |
| 422 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://g") == 0); |
| 423 |
ref = UriType("?y"); |
| 424 |
res = ref.Resolve(base); |
| 425 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/d;p?y") == 0); |
| 426 |
ref = UriType("g?y"); |
| 427 |
res = ref.Resolve(base); |
| 428 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/g?y") == 0); |
| 429 |
ref = UriType("#s"); |
| 430 |
res = ref.Resolve(base); |
| 431 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/d;p?q#s") == 0); |
| 432 |
ref = UriType("g#s"); |
| 433 |
res = ref.Resolve(base); |
| 434 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/g#s") == 0); |
| 435 |
ref = UriType("g?y#s"); |
| 436 |
res = ref.Resolve(base); |
| 437 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/g?y#s") == 0); |
| 438 |
ref = UriType(";x"); |
| 439 |
res = ref.Resolve(base); |
| 440 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/;x") == 0); |
| 441 |
ref = UriType("g;x"); |
| 442 |
res = ref.Resolve(base); |
| 443 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/g;x") == 0); |
| 444 |
ref = UriType("g;x?y#s"); |
| 445 |
res = ref.Resolve(base); |
| 446 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/g;x?y#s") == 0); |
| 447 |
ref = UriType(""); |
| 448 |
res = ref.Resolve(base); |
| 449 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/d;p?q") == 0); |
| 450 |
ref = UriType("."); |
| 451 |
res = ref.Resolve(base); |
| 452 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/") == 0); |
| 453 |
ref = UriType("./"); |
| 454 |
res = ref.Resolve(base); |
| 455 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/") == 0); |
| 456 |
ref = UriType(".."); |
| 457 |
res = ref.Resolve(base); |
| 458 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/") == 0); |
| 459 |
ref = UriType("../"); |
| 460 |
res = ref.Resolve(base); |
| 461 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/") == 0); |
| 462 |
ref = UriType("../g"); |
| 463 |
res = ref.Resolve(base); |
| 464 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/g") == 0); |
| 465 |
ref = UriType("../.."); |
| 466 |
res = ref.Resolve(base); |
| 467 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/") == 0); |
| 468 |
ref = UriType("../../"); |
| 469 |
res = ref.Resolve(base); |
| 470 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/") == 0); |
| 471 |
ref = UriType("../../g"); |
| 472 |
res = ref.Resolve(base); |
| 473 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/g") == 0); |
| 474 |
ref = UriType("../../../g"); |
| 475 |
res = ref.Resolve(base); |
| 476 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/g") == 0); |
| 477 |
ref = UriType("../../../../g"); |
| 478 |
res = ref.Resolve(base); |
| 479 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/g") == 0); |
| 480 |
ref = UriType("/./g"); |
| 481 |
res = ref.Resolve(base); |
| 482 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/g") == 0); |
| 483 |
ref = UriType("/../g"); |
| 484 |
res = ref.Resolve(base); |
| 485 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/g") == 0); |
| 486 |
ref = UriType("g."); |
| 487 |
res = ref.Resolve(base); |
| 488 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/g.") == 0); |
| 489 |
ref = UriType(".g"); |
| 490 |
res = ref.Resolve(base); |
| 491 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/.g") == 0); |
| 492 |
ref = UriType("g.."); |
| 493 |
res = ref.Resolve(base); |
| 494 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/g..") == 0); |
| 495 |
ref = UriType("..g"); |
| 496 |
res = ref.Resolve(base); |
| 497 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/..g") == 0); |
| 498 |
ref = UriType("g#s/../x"); |
| 499 |
res = ref.Resolve(base); |
| 500 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://a/b/c/g#s/../x") == 0); |
| 501 |
} |
| 502 |
|
| 503 |
TEST(Uri, Resolve_UTF16) { |
| 504 |
typedef GenericValue<UTF16<> > Value16; |
| 505 |
typedef GenericUri<Value16> UriType; |
| 506 |
CrtAllocator allocator; |
| 507 |
|
| 508 |
// ref is full uri |
| 509 |
UriType base = UriType(L"http://auth/path/#frag"); |
| 510 |
UriType ref = UriType(L"http://newauth/newpath#newfrag"); |
| 511 |
UriType res = ref.Resolve(base); |
| 512 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://newauth/newpath#newfrag") == 0); |
| 513 |
|
| 514 |
base = UriType(L"/path/#frag"); |
| 515 |
ref = UriType(L"http://newauth/newpath#newfrag"); |
| 516 |
res = ref.Resolve(base); |
| 517 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://newauth/newpath#newfrag") == 0); |
| 518 |
|
| 519 |
// ref is alternate uri |
| 520 |
base = UriType(L"http://auth/path/#frag"); |
| 521 |
ref = UriType(L"urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f"); |
| 522 |
res = ref.Resolve(base); |
| 523 |
EXPECT_TRUE(StrCmp(res.GetString(), L"urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f") == 0); |
| 524 |
|
| 525 |
// ref is absolute path |
| 526 |
base = UriType(L"http://auth/path/#"); |
| 527 |
ref = UriType(L"/newpath#newfrag"); |
| 528 |
res = ref.Resolve(base); |
| 529 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://auth/newpath#newfrag") == 0); |
| 530 |
|
| 531 |
// ref is relative path |
| 532 |
base = UriType(L"http://auth/path/file.json#frag"); |
| 533 |
ref = UriType(L"newfile.json#"); |
| 534 |
res = ref.Resolve(base); |
| 535 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://auth/path/newfile.json#") == 0); |
| 536 |
|
| 537 |
base = UriType(L"http://auth/path/file.json#frag/stuff"); |
| 538 |
ref = UriType(L"newfile.json#newfrag/newstuff"); |
| 539 |
res = ref.Resolve(base); |
| 540 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://auth/path/newfile.json#newfrag/newstuff") == 0); |
| 541 |
|
| 542 |
base = UriType(L"file.json", &allocator); |
| 543 |
ref = UriType(L"newfile.json", &base.GetAllocator()); |
| 544 |
res = ref.Resolve(base, &ref.GetAllocator()); |
| 545 |
EXPECT_TRUE(StrCmp(res.GetString(), L"newfile.json") == 0); |
| 546 |
|
| 547 |
base = UriType(L"file.json", &allocator); |
| 548 |
ref = UriType(L"./newfile.json", &allocator); |
| 549 |
res = ref.Resolve(base, &allocator); |
| 550 |
EXPECT_TRUE(StrCmp(res.GetString(), L"newfile.json") == 0); |
| 551 |
|
| 552 |
base = UriType(L"file.json"); |
| 553 |
ref = UriType(L"parent/../newfile.json"); |
| 554 |
res = ref.Resolve(base); |
| 555 |
EXPECT_TRUE(StrCmp(res.GetString(), L"newfile.json") == 0); |
| 556 |
|
| 557 |
base = UriType(L"file.json"); |
| 558 |
ref = UriType(L"parent/./newfile.json"); |
| 559 |
res = ref.Resolve(base); |
| 560 |
EXPECT_TRUE(StrCmp(res.GetString(), L"parent/newfile.json") == 0); |
| 561 |
|
| 562 |
base = UriType(L"file.json"); |
| 563 |
ref = UriType(L"../../parent/.././newfile.json"); |
| 564 |
res = ref.Resolve(base); |
| 565 |
EXPECT_TRUE(StrCmp(res.GetString(), L"newfile.json") == 0); |
| 566 |
|
| 567 |
// This adds a joining slash so resolved length is base length + ref length + 1 |
| 568 |
base = UriType(L"http://auth"); |
| 569 |
ref = UriType(L"newfile.json"); |
| 570 |
res = ref.Resolve(base); |
| 571 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://auth/newfile.json") == 0); |
| 572 |
|
| 573 |
// ref is fragment |
| 574 |
base = UriType(L"#frag/stuff"); |
| 575 |
ref = UriType(L"#newfrag/newstuff"); |
| 576 |
res = ref.Resolve(base); |
| 577 |
EXPECT_TRUE(StrCmp(res.GetString(), L"#newfrag/newstuff") == 0); |
| 578 |
|
| 579 |
// test ref fragment always wins |
| 580 |
base = UriType(L"/path#frag"); |
| 581 |
ref = UriType(L""); |
| 582 |
res = ref.Resolve(base); |
| 583 |
EXPECT_TRUE(StrCmp(res.GetString(), L"/path") == 0); |
| 584 |
|
| 585 |
// Examples from RFC3896 |
| 586 |
base = UriType(L"http://a/b/c/d;p?q"); |
| 587 |
ref = UriType(L"g:h"); |
| 588 |
res = ref.Resolve(base); |
| 589 |
EXPECT_TRUE(StrCmp(res.GetString(), L"g:h") == 0); |
| 590 |
ref = UriType(L"g"); |
| 591 |
res = ref.Resolve(base); |
| 592 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/g") == 0); |
| 593 |
ref = UriType(L"./g"); |
| 594 |
res = ref.Resolve(base); |
| 595 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/g") == 0); |
| 596 |
ref = UriType(L"g/"); |
| 597 |
res = ref.Resolve(base); |
| 598 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/g/") == 0); |
| 599 |
ref = UriType(L"/g"); |
| 600 |
res = ref.Resolve(base); |
| 601 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/g") == 0); |
| 602 |
ref = UriType(L"//g"); |
| 603 |
res = ref.Resolve(base); |
| 604 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://g") == 0); |
| 605 |
ref = UriType(L"?y"); |
| 606 |
res = ref.Resolve(base); |
| 607 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/d;p?y") == 0); |
| 608 |
ref = UriType(L"g?y"); |
| 609 |
res = ref.Resolve(base); |
| 610 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/g?y") == 0); |
| 611 |
ref = UriType(L"#s"); |
| 612 |
res = ref.Resolve(base); |
| 613 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/d;p?q#s") == 0); |
| 614 |
ref = UriType(L"g#s"); |
| 615 |
res = ref.Resolve(base); |
| 616 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/g#s") == 0); |
| 617 |
ref = UriType(L"g?y#s"); |
| 618 |
res = ref.Resolve(base); |
| 619 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/g?y#s") == 0); |
| 620 |
ref = UriType(L";x"); |
| 621 |
res = ref.Resolve(base); |
| 622 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/;x") == 0); |
| 623 |
ref = UriType(L"g;x"); |
| 624 |
res = ref.Resolve(base); |
| 625 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/g;x") == 0); |
| 626 |
ref = UriType(L"g;x?y#s"); |
| 627 |
res = ref.Resolve(base); |
| 628 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/g;x?y#s") == 0); |
| 629 |
ref = UriType(L""); |
| 630 |
res = ref.Resolve(base); |
| 631 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/d;p?q") == 0); |
| 632 |
ref = UriType(L"."); |
| 633 |
res = ref.Resolve(base); |
| 634 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/") == 0); |
| 635 |
ref = UriType(L"./"); |
| 636 |
res = ref.Resolve(base); |
| 637 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/") == 0); |
| 638 |
ref = UriType(L".."); |
| 639 |
res = ref.Resolve(base); |
| 640 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/") == 0); |
| 641 |
ref = UriType(L"../"); |
| 642 |
res = ref.Resolve(base); |
| 643 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/") == 0); |
| 644 |
ref = UriType(L"../g"); |
| 645 |
res = ref.Resolve(base); |
| 646 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/g") == 0); |
| 647 |
ref = UriType(L"../.."); |
| 648 |
res = ref.Resolve(base); |
| 649 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/") == 0); |
| 650 |
ref = UriType(L"../../"); |
| 651 |
res = ref.Resolve(base); |
| 652 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/") == 0); |
| 653 |
ref = UriType(L"../../g"); |
| 654 |
res = ref.Resolve(base); |
| 655 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/g") == 0); |
| 656 |
ref = UriType(L"../../../g"); |
| 657 |
res = ref.Resolve(base); |
| 658 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/g") == 0); |
| 659 |
ref = UriType(L"../../../../g"); |
| 660 |
res = ref.Resolve(base); |
| 661 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/g") == 0); |
| 662 |
ref = UriType(L"/./g"); |
| 663 |
res = ref.Resolve(base); |
| 664 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/g") == 0); |
| 665 |
ref = UriType(L"/../g"); |
| 666 |
res = ref.Resolve(base); |
| 667 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/g") == 0); |
| 668 |
ref = UriType(L"g."); |
| 669 |
res = ref.Resolve(base); |
| 670 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/g.") == 0); |
| 671 |
ref = UriType(L".g"); |
| 672 |
res = ref.Resolve(base); |
| 673 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/.g") == 0); |
| 674 |
ref = UriType(L"g.."); |
| 675 |
res = ref.Resolve(base); |
| 676 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/g..") == 0); |
| 677 |
ref = UriType(L"..g"); |
| 678 |
res = ref.Resolve(base); |
| 679 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/..g") == 0); |
| 680 |
ref = UriType(L"g#s/../x"); |
| 681 |
res = ref.Resolve(base); |
| 682 |
EXPECT_TRUE(StrCmp(res.GetString(), L"http://a/b/c/g#s/../x") == 0); |
| 683 |
} |
| 684 |
|
| 685 |
TEST(Uri, Equals) { |
| 686 |
typedef GenericUri<Value> UriType; |
| 687 |
|
| 688 |
UriType a = UriType("http://a/a#a"); |
| 689 |
UriType b = UriType("http://a/a#b"); |
| 690 |
UriType c = a; |
| 691 |
|
| 692 |
EXPECT_TRUE(a == a); |
| 693 |
EXPECT_TRUE(a == c); |
| 694 |
EXPECT_TRUE(a != b); |
| 695 |
} |
| 696 |
|
| 697 |
TEST(Uri, Match) { |
| 698 |
typedef GenericUri<Value> UriType; |
| 699 |
|
| 700 |
UriType a = UriType("http://a/a#a"); |
| 701 |
UriType b = UriType("http://a/a#b"); |
| 702 |
UriType c = a; |
| 703 |
UriType d; |
| 704 |
|
| 705 |
EXPECT_TRUE(a.Match(a)); |
| 706 |
EXPECT_TRUE(a.Match(c)); |
| 707 |
EXPECT_FALSE(a.Match(b)); |
| 708 |
EXPECT_FALSE(a.Match(b, true)); |
| 709 |
EXPECT_TRUE(a.Match(b, false)); // Base Uri same |
| 710 |
EXPECT_FALSE(a.Match(d)); |
| 711 |
EXPECT_FALSE(d.Match(a)); |
| 712 |
} |
| 713 |
|
| 714 |
TEST(Uri, Issue1899) { |
| 715 |
typedef GenericUri<Value, MemoryPoolAllocator<> > UriType; |
| 716 |
|
| 717 |
UriType base = UriType("http://auth/path/#frag"); |
| 718 |
UriType ref = UriType("http://newauth/newpath#newfrag"); |
| 719 |
UriType res = ref.Resolve(base); |
| 720 |
EXPECT_TRUE(StrCmp(res.GetString(), "http://newauth/newpath#newfrag") == 0); |
| 721 |
} |
| 722 |
|
| 723 |
#if defined(_MSC_VER) || defined(__clang__) |
| 724 |
RAPIDJSON_DIAG_POP |
| 725 |
#endif |