1 /*
2     __ _____ _____ _____
3  __|  |   __|     |   | |  JSON for Modern C++ (test suite)
4 |  |  |__   |  |  | | | |  version 3.10.4
5 |_____|_____|_____|_|___|  https://github.com/nlohmann/json
6 
7 Licensed under the MIT License <http://opensource.org/licenses/MIT>.
8 SPDX-License-Identifier: MIT
9 Copyright (c) 2013-2019 Niels Lohmann <http://nlohmann.me>.
10 
11 Permission is hereby  granted, free of charge, to any  person obtaining a copy
12 of this software and associated  documentation files (the "Software"), to deal
13 in the Software  without restriction, including without  limitation the rights
14 to  use, copy,  modify, merge,  publish, distribute,  sublicense, and/or  sell
15 copies  of  the Software,  and  to  permit persons  to  whom  the Software  is
16 furnished to do so, subject to the following conditions:
17 
18 The above copyright notice and this permission notice shall be included in all
19 copies or substantial portions of the Software.
20 
21 THE SOFTWARE  IS PROVIDED "AS  IS", WITHOUT WARRANTY  OF ANY KIND,  EXPRESS OR
22 IMPLIED,  INCLUDING BUT  NOT  LIMITED TO  THE  WARRANTIES OF  MERCHANTABILITY,
23 FITNESS FOR  A PARTICULAR PURPOSE AND  NONINFRINGEMENT. IN NO EVENT  SHALL THE
24 AUTHORS  OR COPYRIGHT  HOLDERS  BE  LIABLE FOR  ANY  CLAIM,  DAMAGES OR  OTHER
25 LIABILITY, WHETHER IN AN ACTION OF  CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 OUT OF OR IN CONNECTION WITH THE SOFTWARE  OR THE USE OR OTHER DEALINGS IN THE
27 SOFTWARE.
28 */
29 
30 #include "doctest_compatibility.h"
31 
32 #include <nlohmann/json.hpp>
33 using nlohmann::json;
34 
35 TEST_CASE("pointer access")
36 {
37     SECTION("pointer access to object_t")
38     {
39         using test_type = json::object_t;
40         json value = {{"one", 1}, {"two", 2}};
41 
42         // check if pointers are returned correctly
43         test_type* p1 = value.get_ptr<test_type*>();
44         CHECK(p1 == value.get_ptr<test_type*>());
45         CHECK(*p1 == value.get<test_type>());
46 
47         const test_type* p2 = value.get_ptr<const test_type*>();
48         CHECK(p2 == value.get_ptr<const test_type*>());
49         CHECK(*p2 == value.get<test_type>());
50 
51         const test_type* const p3 = value.get_ptr<const test_type* const>();
52         CHECK(p3 == value.get_ptr<const test_type* const>());
53         CHECK(*p3 == value.get<test_type>());
54 
55         // check if null pointers are returned correctly
56         CHECK(value.get_ptr<json::object_t*>() != nullptr);
57         CHECK(value.get_ptr<json::array_t*>() == nullptr);
58         CHECK(value.get_ptr<json::string_t*>() == nullptr);
59         CHECK(value.get_ptr<json::boolean_t*>() == nullptr);
60         CHECK(value.get_ptr<json::number_integer_t*>() == nullptr);
61         CHECK(value.get_ptr<json::number_unsigned_t*>() == nullptr);
62         CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
63         CHECK(value.get_ptr<json::binary_t*>() == nullptr);
64     }
65 
66     SECTION("pointer access to const object_t")
67     {
68         using test_type = const json::object_t;
69         const json value = {{"one", 1}, {"two", 2}};
70 
71         // check if pointers are returned correctly
72         test_type* p1 = value.get_ptr<test_type*>();
73         CHECK(p1 == value.get_ptr<test_type*>());
74         CHECK(*p1 == value.get<test_type>());
75 
76         const test_type* p2 = value.get_ptr<const test_type*>();
77         CHECK(p2 == value.get_ptr<const test_type*>());
78         CHECK(*p2 == value.get<test_type>());
79 
80         const test_type* const p3 = value.get_ptr<const test_type* const>();
81         CHECK(p3 == value.get_ptr<const test_type* const>());
82         CHECK(*p3 == value.get<test_type>());
83 
84         // check if null pointers are returned correctly
85         CHECK(value.get_ptr<const json::object_t*>() != nullptr);
86         CHECK(value.get_ptr<const json::array_t*>() == nullptr);
87         CHECK(value.get_ptr<const json::string_t*>() == nullptr);
88         CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
89         CHECK(value.get_ptr<const json::number_integer_t*>() == nullptr);
90         CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
91         CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
92         CHECK(value.get_ptr<const json::binary_t*>() == nullptr);
93     }
94 
95     SECTION("pointer access to array_t")
96     {
97         using test_type = json::array_t;
98         json value = {1, 2, 3, 4};
99 
100         // check if pointers are returned correctly
101         test_type* p1 = value.get_ptr<test_type*>();
102         CHECK(p1 == value.get_ptr<test_type*>());
103         CHECK(*p1 == value.get<test_type>());
104 
105         const test_type* p2 = value.get_ptr<const test_type*>();
106         CHECK(p2 == value.get_ptr<const test_type*>());
107         CHECK(*p2 == value.get<test_type>());
108 
109         const test_type* const p3 = value.get_ptr<const test_type* const>();
110         CHECK(p3 == value.get_ptr<const test_type* const>());
111         CHECK(*p3 == value.get<test_type>());
112 
113         // check if null pointers are returned correctly
114         CHECK(value.get_ptr<json::object_t*>() == nullptr);
115         CHECK(value.get_ptr<json::array_t*>() != nullptr);
116         CHECK(value.get_ptr<json::string_t*>() == nullptr);
117         CHECK(value.get_ptr<json::boolean_t*>() == nullptr);
118         CHECK(value.get_ptr<json::number_integer_t*>() == nullptr);
119         CHECK(value.get_ptr<json::number_unsigned_t*>() == nullptr);
120         CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
121         CHECK(value.get_ptr<json::binary_t*>() == nullptr);
122     }
123 
124     SECTION("pointer access to const array_t")
125     {
126         using test_type = const json::array_t;
127         const json value = {1, 2, 3, 4};
128 
129         // check if pointers are returned correctly
130         test_type* p1 = value.get_ptr<test_type*>();
131         CHECK(p1 == value.get_ptr<test_type*>());
132         CHECK(*p1 == value.get<test_type>());
133 
134         const test_type* p2 = value.get_ptr<const test_type*>();
135         CHECK(p2 == value.get_ptr<const test_type*>());
136         CHECK(*p2 == value.get<test_type>());
137 
138         const test_type* const p3 = value.get_ptr<const test_type* const>();
139         CHECK(p3 == value.get_ptr<const test_type* const>());
140         CHECK(*p3 == value.get<test_type>());
141 
142         // check if null pointers are returned correctly
143         CHECK(value.get_ptr<const json::object_t*>() == nullptr);
144         CHECK(value.get_ptr<const json::array_t*>() != nullptr);
145         CHECK(value.get_ptr<const json::string_t*>() == nullptr);
146         CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
147         CHECK(value.get_ptr<const json::number_integer_t*>() == nullptr);
148         CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
149         CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
150         CHECK(value.get_ptr<const json::binary_t*>() == nullptr);
151     }
152 
153     SECTION("pointer access to string_t")
154     {
155         using test_type = json::string_t;
156         json value = "hello";
157 
158         // check if pointers are returned correctly
159         test_type* p1 = value.get_ptr<test_type*>();
160         CHECK(p1 == value.get_ptr<test_type*>());
161         CHECK(*p1 == value.get<test_type>());
162 
163         const test_type* p2 = value.get_ptr<const test_type*>();
164         CHECK(p2 == value.get_ptr<const test_type*>());
165         CHECK(*p2 == value.get<test_type>());
166 
167         const test_type* const p3 = value.get_ptr<const test_type* const>();
168         CHECK(p3 == value.get_ptr<const test_type* const>());
169         CHECK(*p3 == value.get<test_type>());
170 
171         // check if null pointers are returned correctly
172         CHECK(value.get_ptr<json::object_t*>() == nullptr);
173         CHECK(value.get_ptr<json::array_t*>() == nullptr);
174         CHECK(value.get_ptr<json::string_t*>() != nullptr);
175         CHECK(value.get_ptr<json::boolean_t*>() == nullptr);
176         CHECK(value.get_ptr<json::number_integer_t*>() == nullptr);
177         CHECK(value.get_ptr<json::number_unsigned_t*>() == nullptr);
178         CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
179         CHECK(value.get_ptr<json::binary_t*>() == nullptr);
180     }
181 
182     SECTION("pointer access to const string_t")
183     {
184         using test_type = const json::string_t;
185         const json value = "hello";
186 
187         // check if pointers are returned correctly
188         test_type* p1 = value.get_ptr<test_type*>();
189         CHECK(p1 == value.get_ptr<test_type*>());
190         CHECK(*p1 == value.get<test_type>());
191 
192         const test_type* p2 = value.get_ptr<const test_type*>();
193         CHECK(p2 == value.get_ptr<const test_type*>());
194         CHECK(*p2 == value.get<test_type>());
195 
196         const test_type* const p3 = value.get_ptr<const test_type* const>();
197         CHECK(p3 == value.get_ptr<const test_type* const>());
198         CHECK(*p3 == value.get<test_type>());
199 
200         // check if null pointers are returned correctly
201         CHECK(value.get_ptr<const json::object_t*>() == nullptr);
202         CHECK(value.get_ptr<const json::array_t*>() == nullptr);
203         CHECK(value.get_ptr<const json::string_t*>() != nullptr);
204         CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
205         CHECK(value.get_ptr<const json::number_integer_t*>() == nullptr);
206         CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
207         CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
208         CHECK(value.get_ptr<const json::binary_t*>() == nullptr);
209     }
210 
211     SECTION("pointer access to boolean_t")
212     {
213         using test_type = json::boolean_t;
214         json value = false;
215 
216         // check if pointers are returned correctly
217         test_type* p1 = value.get_ptr<test_type*>();
218         CHECK(p1 == value.get_ptr<test_type*>());
219         CHECK(*p1 == value.get<test_type>());
220 
221         const test_type* p2 = value.get_ptr<const test_type*>();
222         CHECK(p2 == value.get_ptr<const test_type*>());
223         CHECK(*p2 == value.get<test_type>());
224 
225         const test_type* const p3 = value.get_ptr<const test_type* const>();
226         CHECK(p3 == value.get_ptr<const test_type* const>());
227         CHECK(*p3 == value.get<test_type>());
228 
229         // check if null pointers are returned correctly
230         CHECK(value.get_ptr<json::object_t*>() == nullptr);
231         CHECK(value.get_ptr<json::array_t*>() == nullptr);
232         CHECK(value.get_ptr<json::string_t*>() == nullptr);
233         CHECK(value.get_ptr<json::boolean_t*>() != nullptr);
234         CHECK(value.get_ptr<json::number_integer_t*>() == nullptr);
235         CHECK(value.get_ptr<json::number_unsigned_t*>() == nullptr);
236         CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
237         CHECK(value.get_ptr<json::binary_t*>() == nullptr);
238     }
239 
240     SECTION("pointer access to const boolean_t")
241     {
242         using test_type = const json::boolean_t;
243         const json value = false;
244 
245         // check if pointers are returned correctly
246         test_type* p1 = value.get_ptr<test_type*>();
247         CHECK(p1 == value.get_ptr<test_type*>());
248         //CHECK(*p1 == value.get<test_type>());
249 
250         const test_type* p2 = value.get_ptr<const test_type*>();
251         CHECK(p2 == value.get_ptr<const test_type*>());
252         CHECK(*p2 == value.get<test_type>());
253 
254         const test_type* const p3 = value.get_ptr<const test_type* const>();
255         CHECK(p3 == value.get_ptr<const test_type* const>());
256         CHECK(*p3 == value.get<test_type>());
257 
258         // check if null pointers are returned correctly
259         CHECK(value.get_ptr<const json::object_t*>() == nullptr);
260         CHECK(value.get_ptr<const json::array_t*>() == nullptr);
261         CHECK(value.get_ptr<const json::string_t*>() == nullptr);
262         CHECK(value.get_ptr<const json::boolean_t*>() != nullptr);
263         CHECK(value.get_ptr<const json::number_integer_t*>() == nullptr);
264         CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
265         CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
266         CHECK(value.get_ptr<const json::binary_t*>() == nullptr);
267     }
268 
269     SECTION("pointer access to number_integer_t")
270     {
271         using test_type = json::number_integer_t;
272         json value = 23;
273 
274         // check if pointers are returned correctly
275         test_type* p1 = value.get_ptr<test_type*>();
276         CHECK(p1 == value.get_ptr<test_type*>());
277         CHECK(*p1 == value.get<test_type>());
278 
279         const test_type* p2 = value.get_ptr<const test_type*>();
280         CHECK(p2 == value.get_ptr<const test_type*>());
281         CHECK(*p2 == value.get<test_type>());
282 
283         const test_type* const p3 = value.get_ptr<const test_type* const>();
284         CHECK(p3 == value.get_ptr<const test_type* const>());
285         CHECK(*p3 == value.get<test_type>());
286 
287         // check if null pointers are returned correctly
288         CHECK(value.get_ptr<json::object_t*>() == nullptr);
289         CHECK(value.get_ptr<json::array_t*>() == nullptr);
290         CHECK(value.get_ptr<json::string_t*>() == nullptr);
291         CHECK(value.get_ptr<json::boolean_t*>() == nullptr);
292         CHECK(value.get_ptr<json::number_integer_t*>() != nullptr);
293         CHECK(value.get_ptr<json::number_unsigned_t*>() == nullptr);
294         CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
295         CHECK(value.get_ptr<json::binary_t*>() == nullptr);
296     }
297 
298     SECTION("pointer access to const number_integer_t")
299     {
300         using test_type = const json::number_integer_t;
301         const json value = 23;
302 
303         // check if pointers are returned correctly
304         test_type* p1 = value.get_ptr<test_type*>();
305         CHECK(p1 == value.get_ptr<test_type*>());
306         CHECK(*p1 == value.get<test_type>());
307 
308         const test_type* p2 = value.get_ptr<const test_type*>();
309         CHECK(p2 == value.get_ptr<const test_type*>());
310         CHECK(*p2 == value.get<test_type>());
311 
312         const test_type* const p3 = value.get_ptr<const test_type* const>();
313         CHECK(p3 == value.get_ptr<const test_type* const>());
314         CHECK(*p3 == value.get<test_type>());
315 
316         // check if null pointers are returned correctly
317         CHECK(value.get_ptr<const json::object_t*>() == nullptr);
318         CHECK(value.get_ptr<const json::array_t*>() == nullptr);
319         CHECK(value.get_ptr<const json::string_t*>() == nullptr);
320         CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
321         CHECK(value.get_ptr<const json::number_integer_t*>() != nullptr);
322         CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
323         CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
324         CHECK(value.get_ptr<const json::binary_t*>() == nullptr);
325     }
326 
327     SECTION("pointer access to number_unsigned_t")
328     {
329         using test_type = json::number_unsigned_t;
330         json value = 23u;
331 
332         // check if pointers are returned correctly
333         test_type* p1 = value.get_ptr<test_type*>();
334         CHECK(p1 == value.get_ptr<test_type*>());
335         CHECK(*p1 == value.get<test_type>());
336 
337         const test_type* p2 = value.get_ptr<const test_type*>();
338         CHECK(p2 == value.get_ptr<const test_type*>());
339         CHECK(*p2 == value.get<test_type>());
340 
341         const test_type* const p3 = value.get_ptr<const test_type* const>();
342         CHECK(p3 == value.get_ptr<const test_type* const>());
343         CHECK(*p3 == value.get<test_type>());
344 
345         // check if null pointers are returned correctly
346         CHECK(value.get_ptr<json::object_t*>() == nullptr);
347         CHECK(value.get_ptr<json::array_t*>() == nullptr);
348         CHECK(value.get_ptr<json::string_t*>() == nullptr);
349         CHECK(value.get_ptr<json::boolean_t*>() == nullptr);
350         CHECK(value.get_ptr<json::number_integer_t*>() != nullptr);
351         CHECK(value.get_ptr<json::number_unsigned_t*>() != nullptr);
352         CHECK(value.get_ptr<json::number_float_t*>() == nullptr);
353         CHECK(value.get_ptr<json::binary_t*>() == nullptr);
354     }
355 
356     SECTION("pointer access to const number_unsigned_t")
357     {
358         using test_type = const json::number_unsigned_t;
359         const json value = 23u;
360 
361         // check if pointers are returned correctly
362         test_type* p1 = value.get_ptr<test_type*>();
363         CHECK(p1 == value.get_ptr<test_type*>());
364         CHECK(*p1 == value.get<test_type>());
365 
366         const test_type* p2 = value.get_ptr<const test_type*>();
367         CHECK(p2 == value.get_ptr<const test_type*>());
368         CHECK(*p2 == value.get<test_type>());
369 
370         const test_type* const p3 = value.get_ptr<const test_type* const>();
371         CHECK(p3 == value.get_ptr<const test_type* const>());
372         CHECK(*p3 == value.get<test_type>());
373 
374         // check if null pointers are returned correctly
375         CHECK(value.get_ptr<const json::object_t*>() == nullptr);
376         CHECK(value.get_ptr<const json::array_t*>() == nullptr);
377         CHECK(value.get_ptr<const json::string_t*>() == nullptr);
378         CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
379         CHECK(value.get_ptr<const json::number_integer_t*>() != nullptr);
380         CHECK(value.get_ptr<const json::number_unsigned_t*>() != nullptr);
381         CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
382         CHECK(value.get_ptr<const json::binary_t*>() == nullptr);
383     }
384 
385     SECTION("pointer access to number_float_t")
386     {
387         using test_type = json::number_float_t;
388         json value = 42.23;
389 
390         // check if pointers are returned correctly
391         test_type* p1 = value.get_ptr<test_type*>();
392         CHECK(p1 == value.get_ptr<test_type*>());
393         CHECK(*p1 == Approx(value.get<test_type>()));
394 
395         const test_type* p2 = value.get_ptr<const test_type*>();
396         CHECK(p2 == value.get_ptr<const test_type*>());
397         CHECK(*p2 == Approx(value.get<test_type>()));
398 
399         const test_type* const p3 = value.get_ptr<const test_type* const>();
400         CHECK(p3 == value.get_ptr<const test_type* const>());
401         CHECK(*p3 == Approx(value.get<test_type>()));
402 
403         // check if null pointers are returned correctly
404         CHECK(value.get_ptr<json::object_t*>() == nullptr);
405         CHECK(value.get_ptr<json::array_t*>() == nullptr);
406         CHECK(value.get_ptr<json::string_t*>() == nullptr);
407         CHECK(value.get_ptr<json::boolean_t*>() == nullptr);
408         CHECK(value.get_ptr<json::number_integer_t*>() == nullptr);
409         CHECK(value.get_ptr<json::number_unsigned_t*>() == nullptr);
410         CHECK(value.get_ptr<json::number_float_t*>() != nullptr);
411         CHECK(value.get_ptr<json::binary_t*>() == nullptr);
412     }
413 
414     SECTION("pointer access to const number_float_t")
415     {
416         using test_type = const json::number_float_t;
417         const json value = 42.23;
418 
419         // check if pointers are returned correctly
420         test_type* p1 = value.get_ptr<test_type*>();
421         CHECK(p1 == value.get_ptr<test_type*>());
422         CHECK(*p1 == Approx(value.get<test_type>()));
423 
424         const test_type* p2 = value.get_ptr<const test_type*>();
425         CHECK(p2 == value.get_ptr<const test_type*>());
426         CHECK(*p2 == Approx(value.get<test_type>()));
427 
428         const test_type* const p3 = value.get_ptr<const test_type* const>();
429         CHECK(p3 == value.get_ptr<const test_type* const>());
430         CHECK(*p3 == Approx(value.get<test_type>()));
431 
432         // check if null pointers are returned correctly
433         CHECK(value.get_ptr<const json::object_t*>() == nullptr);
434         CHECK(value.get_ptr<const json::array_t*>() == nullptr);
435         CHECK(value.get_ptr<const json::string_t*>() == nullptr);
436         CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
437         CHECK(value.get_ptr<const json::number_integer_t*>() == nullptr);
438         CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
439         CHECK(value.get_ptr<const json::number_float_t*>() != nullptr);
440         CHECK(value.get_ptr<const json::binary_t*>() == nullptr);
441     }
442 
443     SECTION("pointer access to const binary_t")
444     {
445         using test_type = const json::binary_t;
446         const json value = json::binary({1, 2, 3});
447 
448         // check if pointers are returned correctly
449         test_type* p1 = value.get_ptr<test_type*>();
450         CHECK(p1 == value.get_ptr<test_type*>());
451         CHECK(*p1 == value.get<test_type>());
452 
453         const test_type* p2 = value.get_ptr<const test_type*>();
454         CHECK(p2 == value.get_ptr<const test_type*>());
455         CHECK(*p2 == value.get<test_type>());
456 
457         const test_type* const p3 = value.get_ptr<const test_type* const>();
458         CHECK(p3 == value.get_ptr<const test_type* const>());
459         CHECK(*p3 == value.get<test_type>());
460 
461         // check if null pointers are returned correctly
462         CHECK(value.get_ptr<const json::object_t*>() == nullptr);
463         CHECK(value.get_ptr<const json::array_t*>() == nullptr);
464         CHECK(value.get_ptr<const json::string_t*>() == nullptr);
465         CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
466         CHECK(value.get_ptr<const json::number_integer_t*>() == nullptr);
467         CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
468         CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
469         CHECK(value.get_ptr<const json::binary_t*>() != nullptr);
470     }
471 
472     SECTION("pointer access to const binary_t")
473     {
474         using test_type = const json::binary_t;
475         const json value = json::binary({});
476 
477         // check if pointers are returned correctly
478         test_type* p1 = value.get_ptr<test_type*>();
479         CHECK(p1 == value.get_ptr<test_type*>());
480         CHECK(*p1 == value.get<test_type>());
481 
482         const test_type* p2 = value.get_ptr<const test_type*>();
483         CHECK(p2 == value.get_ptr<const test_type*>());
484         CHECK(*p2 == value.get<test_type>());
485 
486         const test_type* const p3 = value.get_ptr<const test_type* const>();
487         CHECK(p3 == value.get_ptr<const test_type* const>());
488         CHECK(*p3 == value.get<test_type>());
489 
490         // check if null pointers are returned correctly
491         CHECK(value.get_ptr<const json::object_t*>() == nullptr);
492         CHECK(value.get_ptr<const json::array_t*>() == nullptr);
493         CHECK(value.get_ptr<const json::string_t*>() == nullptr);
494         CHECK(value.get_ptr<const json::boolean_t*>() == nullptr);
495         CHECK(value.get_ptr<const json::number_integer_t*>() == nullptr);
496         CHECK(value.get_ptr<const json::number_unsigned_t*>() == nullptr);
497         CHECK(value.get_ptr<const json::number_float_t*>() == nullptr);
498         CHECK(value.get_ptr<const json::binary_t*>() != nullptr);
499     }
500 }
501