comparison tests/libcommon/util/main.cpp @ 182:3107ce017c3a

Misc: switch back to SDL Qt Quick and QML was an exciting experiment but it's definitely not enough flexible and easy to use for game development. Using SDL2 will let us focusing on our own drawing functions without any kind of overhead. While here, start massive cleanup.
author David Demelier <markand@malikania.fr>
date Fri, 19 Oct 2018 20:18:19 +0200
parents a3af3b793da4
children
comparison
equal deleted inserted replaced
181:fbfc2555bda5 182:3107ce017c3a
27 27
28 namespace nlohmann { 28 namespace nlohmann {
29 29
30 namespace detail { 30 namespace detail {
31 31
32 std::ostream& operator<<(std::ostream& out, json::value_t type) 32 auto operator<<(std::ostream& out, json::value_t type) -> std::ostream&
33 { 33 {
34 out << json(type).type_name(); 34 out << json(type).type_name();
35 return out; 35 return out;
36 } 36 }
37 37
38 } // !detail 38 } // !detail
39 39
40 } // !nlohmann 40 } // !nlohmann
46 46
47 BOOST_AUTO_TEST_SUITE(clamp) 47 BOOST_AUTO_TEST_SUITE(clamp)
48 48
49 BOOST_AUTO_TEST_CASE(normal) 49 BOOST_AUTO_TEST_CASE(normal)
50 { 50 {
51 BOOST_REQUIRE_EQUAL(5, util::clamp(5, 0, 10)); 51 BOOST_REQUIRE_EQUAL(5, util::clamp(5, 0, 10));
52 } 52 }
53 53
54 BOOST_AUTO_TEST_CASE(minimum) 54 BOOST_AUTO_TEST_CASE(minimum)
55 { 55 {
56 BOOST_REQUIRE_EQUAL(0, util::clamp(0, 0, 10)); 56 BOOST_REQUIRE_EQUAL(0, util::clamp(0, 0, 10));
57 } 57 }
58 58
59 BOOST_AUTO_TEST_CASE(maximum) 59 BOOST_AUTO_TEST_CASE(maximum)
60 { 60 {
61 BOOST_REQUIRE_EQUAL(10, util::clamp(10, 0, 10)); 61 BOOST_REQUIRE_EQUAL(10, util::clamp(10, 0, 10));
62 } 62 }
63 63
64 BOOST_AUTO_TEST_CASE(less) 64 BOOST_AUTO_TEST_CASE(less)
65 { 65 {
66 BOOST_REQUIRE_EQUAL(0, util::clamp(-10, 0, 10)); 66 BOOST_REQUIRE_EQUAL(0, util::clamp(-10, 0, 10));
67 } 67 }
68 68
69 BOOST_AUTO_TEST_CASE(higher) 69 BOOST_AUTO_TEST_CASE(higher)
70 { 70 {
71 BOOST_REQUIRE_EQUAL(10, util::clamp(20, 0, 10)); 71 BOOST_REQUIRE_EQUAL(10, util::clamp(20, 0, 10));
72 } 72 }
73 73
74 BOOST_AUTO_TEST_SUITE_END() 74 BOOST_AUTO_TEST_SUITE_END()
75 75
76 /* 76 /*
80 80
81 BOOST_AUTO_TEST_SUITE(json_require) 81 BOOST_AUTO_TEST_SUITE(json_require)
82 82
83 BOOST_AUTO_TEST_CASE(simple) 83 BOOST_AUTO_TEST_CASE(simple)
84 { 84 {
85 json object{ 85 json object{
86 { "b", true }, 86 { "b", true },
87 { "i", 123 }, 87 { "i", 123 },
88 { "s", "blabla" } 88 { "s", "blabla" }
89 }; 89 };
90 90
91 BOOST_REQUIRE_EQUAL(util::json::require( 91 BOOST_REQUIRE_EQUAL(util::json::require(
92 object, "/b"_json_pointer, json::value_t::boolean).type(), json::value_t::boolean); 92 object, "/b"_json_pointer, json::value_t::boolean).type(), json::value_t::boolean);
93 BOOST_REQUIRE_EQUAL(util::json::require( 93 BOOST_REQUIRE_EQUAL(util::json::require(
94 object, "/i"_json_pointer, json::value_t::number_integer).type(), json::value_t::number_integer); 94 object, "/i"_json_pointer, json::value_t::number_integer).type(), json::value_t::number_integer);
95 BOOST_REQUIRE_EQUAL(util::json::require( 95 BOOST_REQUIRE_EQUAL(util::json::require(
96 object, "/s"_json_pointer, json::value_t::string).type(), json::value_t::string); 96 object, "/s"_json_pointer, json::value_t::string).type(), json::value_t::string);
97 } 97 }
98 98
99 BOOST_AUTO_TEST_CASE(nonexistent) 99 BOOST_AUTO_TEST_CASE(nonexistent)
100 { 100 {
101 auto json = json::object(); 101 auto json = json::object();
102 102
103 try { 103 try {
104 util::json::require(json, "/non-existent"_json_pointer, json::value_t::string); 104 util::json::require(json, "/non-existent"_json_pointer, json::value_t::string);
105 BOOST_FAIL("exception expected"); 105 BOOST_FAIL("exception expected");
106 } catch (const util::json::property_error& ex) { 106 } catch (const util::json::property_error& ex) {
107 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::null); 107 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::null);
108 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::string); 108 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::string);
109 } 109 }
110 } 110 }
111 111
112 BOOST_AUTO_TEST_CASE(invalid) 112 BOOST_AUTO_TEST_CASE(invalid)
113 { 113 {
114 json object{ 114 json object{
115 { "not-string", 123 } 115 { "not-string", 123 }
116 }; 116 };
117 117
118 try { 118 try {
119 util::json::require(object, "/not-string"_json_pointer, json::value_t::string); 119 util::json::require(object, "/not-string"_json_pointer, json::value_t::string);
120 BOOST_FAIL("exception expected"); 120 BOOST_FAIL("exception expected");
121 } catch (const util::json::property_error& ex) { 121 } catch (const util::json::property_error& ex) {
122 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::number_integer); 122 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::number_integer);
123 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::string); 123 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::string);
124 } 124 }
125 } 125 }
126 126
127 BOOST_AUTO_TEST_SUITE_END() 127 BOOST_AUTO_TEST_SUITE_END()
128 128
129 /* 129 /*
133 133
134 BOOST_AUTO_TEST_SUITE(json_require_array) 134 BOOST_AUTO_TEST_SUITE(json_require_array)
135 135
136 BOOST_AUTO_TEST_CASE(simple) 136 BOOST_AUTO_TEST_CASE(simple)
137 { 137 {
138 json object{ 138 json object{
139 { "a", { 1, 2, 3 } }, 139 { "a", { 1, 2, 3 } },
140 { "l1", { 140 { "l1", {
141 { "l2", { 4, 5, 6 } } 141 { "l2", { 4, 5, 6 } }
142 } 142 }
143 } 143 }
144 }; 144 };
145 145
146 auto a = util::json::require_array(object, "/a"_json_pointer); 146 auto a = util::json::require_array(object, "/a"_json_pointer);
147 auto l2 = util::json::require_array(object, "/l1/l2"_json_pointer); 147 auto l2 = util::json::require_array(object, "/l1/l2"_json_pointer);
148 148
149 BOOST_REQUIRE(a.is_array()); 149 BOOST_REQUIRE(a.is_array());
150 BOOST_REQUIRE(l2.is_array()); 150 BOOST_REQUIRE(l2.is_array());
151 } 151 }
152 152
153 BOOST_AUTO_TEST_CASE(invalid) 153 BOOST_AUTO_TEST_CASE(invalid)
154 { 154 {
155 json object{ 155 json object{
156 { "not-array", 123 } 156 { "not-array", 123 }
157 }; 157 };
158 158
159 try { 159 try {
160 util::json::require_array(object, "/not-array"_json_pointer); 160 util::json::require_array(object, "/not-array"_json_pointer);
161 BOOST_FAIL("exception expected"); 161 BOOST_FAIL("exception expected");
162 } catch (const util::json::property_error& ex) { 162 } catch (const util::json::property_error& ex) {
163 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::number_integer); 163 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::number_integer);
164 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::array); 164 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::array);
165 } 165 }
166 } 166 }
167 167
168 BOOST_AUTO_TEST_SUITE_END() 168 BOOST_AUTO_TEST_SUITE_END()
169 169
170 /* 170 /*
174 174
175 BOOST_AUTO_TEST_SUITE(json_require_bool) 175 BOOST_AUTO_TEST_SUITE(json_require_bool)
176 176
177 BOOST_AUTO_TEST_CASE(simple) 177 BOOST_AUTO_TEST_CASE(simple)
178 { 178 {
179 json object{ 179 json object{
180 { "b", true } 180 { "b", true }
181 }; 181 };
182 182
183 BOOST_REQUIRE_EQUAL(util::json::require_bool(object, "/b"_json_pointer), true); 183 BOOST_REQUIRE_EQUAL(util::json::require_bool(object, "/b"_json_pointer), true);
184 } 184 }
185 185
186 BOOST_AUTO_TEST_CASE(invalid) 186 BOOST_AUTO_TEST_CASE(invalid)
187 { 187 {
188 json object{ 188 json object{
189 { "not-bool", 123 } 189 { "not-bool", 123 }
190 }; 190 };
191 191
192 try { 192 try {
193 util::json::require_bool(object, "/not-bool"_json_pointer); 193 util::json::require_bool(object, "/not-bool"_json_pointer);
194 BOOST_FAIL("exception expected"); 194 BOOST_FAIL("exception expected");
195 } catch (const util::json::property_error& ex) { 195 } catch (const util::json::property_error& ex) {
196 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::number_integer); 196 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::number_integer);
197 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::boolean); 197 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::boolean);
198 } 198 }
199 } 199 }
200 200
201 BOOST_AUTO_TEST_SUITE_END() 201 BOOST_AUTO_TEST_SUITE_END()
202 202
203 /* 203 /*
207 207
208 BOOST_AUTO_TEST_SUITE(json_require_int) 208 BOOST_AUTO_TEST_SUITE(json_require_int)
209 209
210 BOOST_AUTO_TEST_CASE(simple) 210 BOOST_AUTO_TEST_CASE(simple)
211 { 211 {
212 json object{ 212 json object{
213 { "i", 123 } 213 { "i", 123 }
214 }; 214 };
215 215
216 BOOST_REQUIRE_EQUAL(util::json::require_int(object, "/i"_json_pointer), 123); 216 BOOST_REQUIRE_EQUAL(util::json::require_int(object, "/i"_json_pointer), 123);
217 } 217 }
218 218
219 BOOST_AUTO_TEST_CASE(invalid) 219 BOOST_AUTO_TEST_CASE(invalid)
220 { 220 {
221 json object{ 221 json object{
222 { "not-int", true } 222 { "not-int", true }
223 }; 223 };
224 224
225 try { 225 try {
226 util::json::require_int(object, "/not-int"_json_pointer); 226 util::json::require_int(object, "/not-int"_json_pointer);
227 BOOST_FAIL("exception expected"); 227 BOOST_FAIL("exception expected");
228 } catch (const util::json::property_error& ex) { 228 } catch (const util::json::property_error& ex) {
229 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::boolean); 229 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::boolean);
230 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::number_integer); 230 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::number_integer);
231 } 231 }
232 } 232 }
233 233
234 BOOST_AUTO_TEST_SUITE_END() 234 BOOST_AUTO_TEST_SUITE_END()
235 235
236 /* 236 /*
240 240
241 BOOST_AUTO_TEST_SUITE(json_require_object) 241 BOOST_AUTO_TEST_SUITE(json_require_object)
242 242
243 BOOST_AUTO_TEST_CASE(simple) 243 BOOST_AUTO_TEST_CASE(simple)
244 { 244 {
245 json object{ 245 json object{
246 { 246 {
247 "network", json::object({ 247 "network", json::object({
248 { "host", "localhost" }, 248 { "host", "localhost" },
249 { "port", 9090 } 249 { "port", 9090 }
250 }) 250 })
251 } 251 }
252 }; 252 };
253 253
254 BOOST_REQUIRE(util::json::require_object(object, "/network"_json_pointer).is_object()); 254 BOOST_REQUIRE(util::json::require_object(object, "/network"_json_pointer).is_object());
255 } 255 }
256 256
257 BOOST_AUTO_TEST_CASE(invalid) 257 BOOST_AUTO_TEST_CASE(invalid)
258 { 258 {
259 json object{ 259 json object{
260 { "not-object", 123 } 260 { "not-object", 123 }
261 }; 261 };
262 262
263 try { 263 try {
264 util::json::require_object(object, "/not-object"_json_pointer); 264 util::json::require_object(object, "/not-object"_json_pointer);
265 BOOST_FAIL("exception expected"); 265 BOOST_FAIL("exception expected");
266 } catch (const util::json::property_error& ex) { 266 } catch (const util::json::property_error& ex) {
267 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::number_integer); 267 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::number_integer);
268 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::object); 268 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::object);
269 } 269 }
270 } 270 }
271 271
272 BOOST_AUTO_TEST_SUITE_END() 272 BOOST_AUTO_TEST_SUITE_END()
273 273
274 /* 274 /*
278 278
279 BOOST_AUTO_TEST_SUITE(json_require_string) 279 BOOST_AUTO_TEST_SUITE(json_require_string)
280 280
281 BOOST_AUTO_TEST_CASE(simple) 281 BOOST_AUTO_TEST_CASE(simple)
282 { 282 {
283 json object{ 283 json object{
284 { "s", "hello" } 284 { "s", "hello" }
285 }; 285 };
286 286
287 BOOST_REQUIRE_EQUAL(util::json::require_string(object, "/s"_json_pointer), "hello"); 287 BOOST_REQUIRE_EQUAL(util::json::require_string(object, "/s"_json_pointer), "hello");
288 } 288 }
289 289
290 BOOST_AUTO_TEST_CASE(invalid) 290 BOOST_AUTO_TEST_CASE(invalid)
291 { 291 {
292 json object{ 292 json object{
293 { "not-string", 123 } 293 { "not-string", 123 }
294 }; 294 };
295 295
296 try { 296 try {
297 util::json::require_string(object, "/not-string"_json_pointer); 297 util::json::require_string(object, "/not-string"_json_pointer);
298 BOOST_FAIL("exception expected"); 298 BOOST_FAIL("exception expected");
299 } catch (const util::json::property_error& ex) { 299 } catch (const util::json::property_error& ex) {
300 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::number_integer); 300 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::number_integer);
301 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::string); 301 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::string);
302 } 302 }
303 } 303 }
304 304
305 BOOST_AUTO_TEST_SUITE_END() 305 BOOST_AUTO_TEST_SUITE_END()
306 306
307 /* 307 /*
311 311
312 BOOST_AUTO_TEST_SUITE(json_require_uint) 312 BOOST_AUTO_TEST_SUITE(json_require_uint)
313 313
314 BOOST_AUTO_TEST_CASE(simple) 314 BOOST_AUTO_TEST_CASE(simple)
315 { 315 {
316 json object{ 316 json object{
317 { "u1", 123U } 317 { "u1", 123U }
318 }; 318 };
319 319
320 BOOST_REQUIRE_EQUAL(util::json::require_uint(object, "/u1"_json_pointer), 123U); 320 BOOST_REQUIRE_EQUAL(util::json::require_uint(object, "/u1"_json_pointer), 123U);
321 } 321 }
322 322
323 BOOST_AUTO_TEST_CASE(invalid) 323 BOOST_AUTO_TEST_CASE(invalid)
324 { 324 {
325 json object{ 325 json object{
326 { "not-uint", true } 326 { "not-uint", true }
327 }; 327 };
328 328
329 try { 329 try {
330 util::json::require_uint(object, "/not-uint"_json_pointer); 330 util::json::require_uint(object, "/not-uint"_json_pointer);
331 BOOST_FAIL("exception expected"); 331 BOOST_FAIL("exception expected");
332 } catch (const util::json::property_error& ex) { 332 } catch (const util::json::property_error& ex) {
333 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::boolean); 333 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::boolean);
334 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::number_unsigned); 334 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::number_unsigned);
335 } 335 }
336 } 336 }
337 337
338 BOOST_AUTO_TEST_SUITE_END() 338 BOOST_AUTO_TEST_SUITE_END()
339 339
340 BOOST_AUTO_TEST_SUITE(json_require_size) 340 BOOST_AUTO_TEST_SUITE(json_require_size)
344 * ------------------------------------------------------------------ 344 * ------------------------------------------------------------------
345 */ 345 */
346 346
347 BOOST_AUTO_TEST_CASE(simple) 347 BOOST_AUTO_TEST_CASE(simple)
348 { 348 {
349 json object{ 349 json object{
350 { "size", { 350 { "size", {
351 { "width", 10 }, 351 { "width", 10 },
352 { "height", 20 } 352 { "height", 20 }
353 } 353 }
354 } 354 }
355 }; 355 };
356 356
357 BOOST_TEST((util::json::require_size(object, "/size"_json_pointer) == mlk::size{10, 20})); 357 BOOST_TEST((util::json::require_size(object, "/size"_json_pointer) == mlk::size{10, 20}));
358 } 358 }
359 359
360 BOOST_AUTO_TEST_CASE(not_object) 360 BOOST_AUTO_TEST_CASE(not_object)
361 { 361 {
362 json object{ 362 json object{
363 { "size", false } 363 { "size", false }
364 }; 364 };
365 365
366 try { 366 try {
367 util::json::require_size(object, "/size"_json_pointer); 367 util::json::require_size(object, "/size"_json_pointer);
368 BOOST_FAIL("exception expected"); 368 BOOST_FAIL("exception expected");
369 } catch (const util::json::property_error& ex) { 369 } catch (const util::json::property_error& ex) {
370 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::null); 370 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::null);
371 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::number_unsigned); 371 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::number_unsigned);
372 } 372 }
373 } 373 }
374 374
375 BOOST_AUTO_TEST_CASE(not_int_width) 375 BOOST_AUTO_TEST_CASE(not_int_width)
376 { 376 {
377 json object{ 377 json object{
378 { "size", { 378 { "size", {
379 { "width", "10" }, 379 { "width", "10" },
380 { "height", 20 } 380 { "height", 20 }
381 } 381 }
382 } 382 }
383 }; 383 };
384 384
385 try { 385 try {
386 util::json::require_size(object, "/size"_json_pointer); 386 util::json::require_size(object, "/size"_json_pointer);
387 BOOST_FAIL("exception expected"); 387 BOOST_FAIL("exception expected");
388 } catch (const util::json::property_error& ex) { 388 } catch (const util::json::property_error& ex) {
389 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::string); 389 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::string);
390 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::number_unsigned); 390 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::number_unsigned);
391 } 391 }
392 } 392 }
393 393
394 BOOST_AUTO_TEST_CASE(not_int_height) 394 BOOST_AUTO_TEST_CASE(not_int_height)
395 { 395 {
396 json object{ 396 json object{
397 { "size", { 397 { "size", {
398 { "width", 10 }, 398 { "width", 10 },
399 { "height", "20" } 399 { "height", "20" }
400 } 400 }
401 } 401 }
402 }; 402 };
403 403
404 try { 404 try {
405 util::json::require_size(object, "/size"_json_pointer); 405 util::json::require_size(object, "/size"_json_pointer);
406 BOOST_FAIL("exception expected"); 406 BOOST_FAIL("exception expected");
407 } catch (const util::json::property_error& ex) { 407 } catch (const util::json::property_error& ex) {
408 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::string); 408 BOOST_REQUIRE_EQUAL(ex.type(), json::value_t::string);
409 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::number_unsigned); 409 BOOST_REQUIRE_EQUAL(ex.expected(), json::value_t::number_unsigned);
410 } 410 }
411 } 411 }
412 412
413 BOOST_AUTO_TEST_SUITE_END() 413 BOOST_AUTO_TEST_SUITE_END()
414 414
415 BOOST_AUTO_TEST_SUITE(json_get_size) 415 BOOST_AUTO_TEST_SUITE(json_get_size)
416 416
417 BOOST_AUTO_TEST_CASE(simple) 417 BOOST_AUTO_TEST_CASE(simple)
418 { 418 {
419 json object{ 419 json object{
420 { "size", { 420 { "size", {
421 { "width", 10 }, 421 { "width", 10 },
422 { "height", 20 } 422 { "height", 20 }
423 } 423 }
424 } 424 }
425 }; 425 };
426 426
427 BOOST_TEST((util::json::get_size(object, "/size"_json_pointer) == mlk::size{10, 20})); 427 BOOST_TEST((util::json::get_size(object, "/size"_json_pointer) == mlk::size{10, 20}));
428 } 428 }
429 429
430 BOOST_AUTO_TEST_CASE(not_object) 430 BOOST_AUTO_TEST_CASE(not_object)
431 { 431 {
432 const json object{{ "size", false }}; 432 const json object{{ "size", false }};
433 const mlk::size def{10, 20}; 433 const mlk::size def{10, 20};
434 434
435 BOOST_TEST(util::json::get_size(object, "/size"_json_pointer, def) == def); 435 BOOST_TEST(util::json::get_size(object, "/size"_json_pointer, def) == def);
436 } 436 }
437 437
438 BOOST_AUTO_TEST_CASE(not_int_width) 438 BOOST_AUTO_TEST_CASE(not_int_width)
439 { 439 {
440 const json object{ 440 const json object{
441 { "size", { 441 { "size", {
442 { "width", "10" }, 442 { "width", "10" },
443 { "height", 20 } 443 { "height", 20 }
444 } 444 }
445 } 445 }
446 }; 446 };
447 447
448 const mlk::size def{10, 20}; 448 const mlk::size def{10, 20};
449 449
450 BOOST_TEST(util::json::get_size(object, "/size"_json_pointer, def) == def); 450 BOOST_TEST(util::json::get_size(object, "/size"_json_pointer, def) == def);
451 } 451 }
452 452
453 BOOST_AUTO_TEST_CASE(not_int_height) 453 BOOST_AUTO_TEST_CASE(not_int_height)
454 { 454 {
455 const json object{ 455 const json object{
456 { "size", { 456 { "size", {
457 { "width", 10 }, 457 { "width", 10 },
458 { "height", "20" } 458 { "height", "20" }
459 } 459 }
460 } 460 }
461 }; 461 };
462 462
463 const mlk::size def{10, 20}; 463 const mlk::size def{10, 20};
464 464
465 BOOST_TEST(util::json::get_size(object, "/size"_json_pointer, def) == def); 465 BOOST_TEST(util::json::get_size(object, "/size"_json_pointer, def) == def);
466 } 466 }
467 467
468 BOOST_AUTO_TEST_SUITE_END() 468 BOOST_AUTO_TEST_SUITE_END()