Lines Matching full:json
3 __| | __| | | | JSON for Modern C++ (test suite)
5 |_____|_____|_____|_|___| https://github.com/nlohmann/json
32 #include <nlohmann/json.hpp>
33 using nlohmann::json;
39 json j = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
40 const json j_const = j;
46 CHECK(j.at(0) == json(1));
47 CHECK(j.at(1) == json(1u));
48 CHECK(j.at(2) == json(true));
49 CHECK(j.at(3) == json(nullptr));
50 CHECK(j.at(4) == json("string"));
51 CHECK(j.at(5) == json(42.23));
52 CHECK(j.at(6) == json::object());
53 CHECK(j.at(7) == json({1, 2, 3}));
55 CHECK(j_const.at(0) == json(1));
56 CHECK(j_const.at(1) == json(1u));
57 CHECK(j_const.at(2) == json(true));
58 CHECK(j_const.at(3) == json(nullptr));
59 CHECK(j_const.at(4) == json("string"));
60 CHECK(j_const.at(5) == json(42.23));
61 CHECK(j_const.at(6) == json::object());
62 CHECK(j_const.at(7) == json({1, 2, 3}));
67 CHECK_THROWS_AS(j.at(8), json::out_of_range&);
68 CHECK_THROWS_AS(j_const.at(8), json::out_of_range&);
71 … "[json.exception.out_of_range.401] array index 8 is out of range");
73 … "[json.exception.out_of_range.401] array index 8 is out of range");
80 json j_nonarray(json::value_t::null);
81 const json j_nonarray_const(j_nonarray);
82 CHECK_THROWS_AS(j_nonarray.at(0), json::type_error&);
83 CHECK_THROWS_AS(j_nonarray_const.at(0), json::type_error&);
85 … CHECK_THROWS_WITH(j_nonarray.at(0), "[json.exception.type_error.304] cannot use at() with null");
86 …CHECK_THROWS_WITH(j_nonarray_const.at(0), "[json.exception.type_error.304] cannot use at() with nu…
91 json j_nonarray(json::value_t::boolean);
92 const json j_nonarray_const(j_nonarray);
93 CHECK_THROWS_AS(j_nonarray.at(0), json::type_error&);
94 CHECK_THROWS_AS(j_nonarray_const.at(0), json::type_error&);
96 …CHECK_THROWS_WITH(j_nonarray.at(0), "[json.exception.type_error.304] cannot use at() with boolean"…
97 …CHECK_THROWS_WITH(j_nonarray_const.at(0), "[json.exception.type_error.304] cannot use at() with bo…
102 json j_nonarray(json::value_t::string);
103 const json j_nonarray_const(j_nonarray);
104 CHECK_THROWS_AS(j_nonarray.at(0), json::type_error&);
105 CHECK_THROWS_AS(j_nonarray_const.at(0), json::type_error&);
107 …CHECK_THROWS_WITH(j_nonarray.at(0), "[json.exception.type_error.304] cannot use at() with string");
108 …CHECK_THROWS_WITH(j_nonarray_const.at(0), "[json.exception.type_error.304] cannot use at() with st…
113 json j_nonarray(json::value_t::object);
114 const json j_nonarray_const(j_nonarray);
115 CHECK_THROWS_AS(j_nonarray.at(0), json::type_error&);
116 CHECK_THROWS_AS(j_nonarray_const.at(0), json::type_error&);
118 …CHECK_THROWS_WITH(j_nonarray.at(0), "[json.exception.type_error.304] cannot use at() with object");
119 …CHECK_THROWS_WITH(j_nonarray_const.at(0), "[json.exception.type_error.304] cannot use at() with ob…
124 json j_nonarray(json::value_t::number_integer);
125 const json j_nonarray_const(j_nonarray);
126 CHECK_THROWS_AS(j_nonarray.at(0), json::type_error&);
127 CHECK_THROWS_AS(j_nonarray_const.at(0), json::type_error&);
129 …CHECK_THROWS_WITH(j_nonarray.at(0), "[json.exception.type_error.304] cannot use at() with number");
130 …CHECK_THROWS_WITH(j_nonarray_const.at(0), "[json.exception.type_error.304] cannot use at() with nu…
135 json j_nonarray(json::value_t::number_unsigned);
136 const json j_nonarray_const(j_nonarray);
137 CHECK_THROWS_AS(j_nonarray.at(0), json::type_error&);
138 CHECK_THROWS_AS(j_nonarray_const.at(0), json::type_error&);
140 …CHECK_THROWS_WITH(j_nonarray.at(0), "[json.exception.type_error.304] cannot use at() with number");
141 …CHECK_THROWS_WITH(j_nonarray_const.at(0), "[json.exception.type_error.304] cannot use at() with nu…
146 json j_nonarray(json::value_t::number_float);
147 const json j_nonarray_const(j_nonarray);
148 CHECK_THROWS_AS(j_nonarray.at(0), json::type_error&);
149 CHECK_THROWS_AS(j_nonarray_const.at(0), json::type_error&);
151 …CHECK_THROWS_WITH(j_nonarray.at(0), "[json.exception.type_error.304] cannot use at() with number");
152 …CHECK_THROWS_WITH(j_nonarray_const.at(0), "[json.exception.type_error.304] cannot use at() with nu…
159 CHECK(j.front() == json(1));
160 CHECK(j_const.front() == json(1));
161 CHECK(j.back() == json({1, 2, 3}));
162 CHECK(j_const.back() == json({1, 2, 3}));
169 CHECK(j[0] == json(1));
170 CHECK(j[1] == json(1u));
171 CHECK(j[2] == json(true));
172 CHECK(j[3] == json(nullptr));
173 CHECK(j[4] == json("string"));
174 CHECK(j[5] == json(42.23));
175 CHECK(j[6] == json::object());
176 CHECK(j[7] == json({1, 2, 3}));
178 CHECK(j_const[0] == json(1));
179 CHECK(j_const[1] == json(1u));
180 CHECK(j_const[2] == json(true));
181 CHECK(j_const[3] == json(nullptr));
182 CHECK(j_const[4] == json("string"));
183 CHECK(j_const[5] == json(42.23));
184 CHECK(j_const[6] == json::object());
185 CHECK(j_const[7] == json({1, 2, 3}));
194 json j_nonarray(json::value_t::null);
195 const json j_nonarray_const(j_nonarray);
197 CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
198 …CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with…
203 json j_nonarray;
205 CHECK(j_nonarray == json({nullptr, nullptr, nullptr, 42}));
211 json j_nonarray(json::value_t::boolean);
212 const json j_nonarray_const(j_nonarray);
213 CHECK_THROWS_AS(j_nonarray[0], json::type_error&);
214 CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
215 …CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with a num…
216 …CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with…
221 json j_nonarray(json::value_t::string);
222 const json j_nonarray_const(j_nonarray);
223 CHECK_THROWS_AS(j_nonarray[0], json::type_error&);
224 CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
225 …CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with a num…
226 …CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with…
231 json j_nonarray(json::value_t::object);
232 const json j_nonarray_const(j_nonarray);
233 CHECK_THROWS_AS(j_nonarray[0], json::type_error&);
234 CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
235 …CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with a num…
236 …CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with…
241 json j_nonarray(json::value_t::number_integer);
242 const json j_nonarray_const(j_nonarray);
243 CHECK_THROWS_AS(j_nonarray[0], json::type_error&);
244 CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
245 …CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with a num…
246 …CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with…
251 json j_nonarray(json::value_t::number_unsigned);
252 const json j_nonarray_const(j_nonarray);
253 CHECK_THROWS_AS(j_nonarray[0], json::type_error&);
254 CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
255 …CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with a num…
256 …CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with…
261 json j_nonarray(json::value_t::number_float);
262 const json j_nonarray_const(j_nonarray);
263 CHECK_THROWS_AS(j_nonarray[0], json::type_error&);
264 CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
265 …CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with a num…
266 …CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with…
276 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
278 … CHECK(jarray == json({1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}}));
281 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
283 … CHECK(jarray == json({1, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}}));
286 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
288 … CHECK(jarray == json({1, 1u, nullptr, "string", 42.23, json::object(), {1, 2, 3}}));
291 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
293 … CHECK(jarray == json({1, 1u, true, "string", 42.23, json::object(), {1, 2, 3}}));
296 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
298 CHECK(jarray == json({1, 1u, true, nullptr, 42.23, json::object(), {1, 2, 3}}));
301 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
303 … CHECK(jarray == json({1, 1u, true, nullptr, "string", json::object(), {1, 2, 3}}));
306 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
308 CHECK(jarray == json({1, 1u, true, nullptr, "string", 42.23, {1, 2, 3}}));
311 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
313 CHECK(jarray == json({1, 1u, true, nullptr, "string", 42.23, json::object()}));
316 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
317 CHECK_THROWS_AS(jarray.erase(8), json::out_of_range&);
319 … "[json.exception.out_of_range.401] array index 8 is out of range");
328 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
329 json::iterator it2 = jarray.erase(jarray.begin());
330 … CHECK(jarray == json({1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}}));
331 CHECK(*it2 == json(1u));
334 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
335 json::const_iterator it2 = jarray.erase(jarray.cbegin());
336 … CHECK(jarray == json({1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}}));
337 CHECK(*it2 == json(1u));
344 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
345 json::iterator it2 = jarray.erase(jarray.begin(), jarray.end());
346 CHECK(jarray == json::array());
350 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
351 json::const_iterator it2 = jarray.erase(jarray.cbegin(), jarray.cend());
352 CHECK(jarray == json::array());
360 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
361 json::iterator it2 = jarray.erase(jarray.begin(), jarray.begin());
362 … CHECK(jarray == json({1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}}));
363 CHECK(*it2 == json(1));
366 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
367 json::const_iterator it2 = jarray.erase(jarray.cbegin(), jarray.cbegin());
368 … CHECK(jarray == json({1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}}));
369 CHECK(*it2 == json(1));
376 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
377 json::iterator it = jarray.begin() + 4;
378 json::iterator it2 = jarray.erase(it);
379 … CHECK(jarray == json({1, 1u, true, nullptr, 42.23, json::object(), {1, 2, 3}}));
380 CHECK(*it2 == json(42.23));
383 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
384 json::const_iterator it = jarray.cbegin() + 4;
385 json::const_iterator it2 = jarray.erase(it);
386 … CHECK(jarray == json({1, 1u, true, nullptr, 42.23, json::object(), {1, 2, 3}}));
387 CHECK(*it2 == json(42.23));
394 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
395 json::iterator it2 = jarray.erase(jarray.begin() + 3, jarray.begin() + 6);
396 CHECK(jarray == json({1, 1u, true, json::object(), {1, 2, 3}}));
397 CHECK(*it2 == json::object());
400 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
401 … json::const_iterator it2 = jarray.erase(jarray.cbegin() + 3, jarray.cbegin() + 6);
402 CHECK(jarray == json({1, 1u, true, json::object(), {1, 2, 3}}));
403 CHECK(*it2 == json::object());
410 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
411 json jarray2 = {"foo", "bar"};
412 CHECK_THROWS_AS(jarray.erase(jarray2.begin()), json::invalid_iterator&);
413 … CHECK_THROWS_AS(jarray.erase(jarray.begin(), jarray2.end()), json::invalid_iterator&);
414 … CHECK_THROWS_AS(jarray.erase(jarray2.begin(), jarray.end()), json::invalid_iterator&);
415 … CHECK_THROWS_AS(jarray.erase(jarray2.begin(), jarray2.end()), json::invalid_iterator&);
418 … "[json.exception.invalid_iterator.202] iterator does not fit current value");
420 … "[json.exception.invalid_iterator.203] iterators do not fit current value");
422 … "[json.exception.invalid_iterator.203] iterators do not fit current value");
424 … "[json.exception.invalid_iterator.203] iterators do not fit current value");
427 … json jarray = {1, 1u, true, nullptr, "string", 42.23, json::object(), {1, 2, 3}};
428 json jarray2 = {"foo", "bar"};
429 CHECK_THROWS_AS(jarray.erase(jarray2.cbegin()), json::invalid_iterator&);
430 … CHECK_THROWS_AS(jarray.erase(jarray.cbegin(), jarray2.cend()), json::invalid_iterator&);
431 … CHECK_THROWS_AS(jarray.erase(jarray2.cbegin(), jarray.cend()), json::invalid_iterator&);
432 … CHECK_THROWS_AS(jarray.erase(jarray2.cbegin(), jarray2.cend()), json::invalid_iterator&);
435 … "[json.exception.invalid_iterator.202] iterator does not fit current value");
437 … "[json.exception.invalid_iterator.203] iterators do not fit current value");
439 … "[json.exception.invalid_iterator.203] iterators do not fit current value");
441 … "[json.exception.invalid_iterator.203] iterators do not fit current value");
450 json j_nonobject(json::value_t::null);
451 CHECK_THROWS_AS(j_nonobject.erase(0), json::type_error&);
453 … "[json.exception.type_error.307] cannot use erase() with null");
458 json j_nonobject(json::value_t::boolean);
459 CHECK_THROWS_AS(j_nonobject.erase(0), json::type_error&);
461 … "[json.exception.type_error.307] cannot use erase() with boolean");
466 json j_nonobject(json::value_t::string);
467 CHECK_THROWS_AS(j_nonobject.erase(0), json::type_error&);
469 … "[json.exception.type_error.307] cannot use erase() with string");
474 json j_nonobject(json::value_t::object);
475 CHECK_THROWS_AS(j_nonobject.erase(0), json::type_error&);
477 … "[json.exception.type_error.307] cannot use erase() with object");
482 json j_nonobject(json::value_t::number_integer);
483 CHECK_THROWS_AS(j_nonobject.erase(0), json::type_error&);
485 … "[json.exception.type_error.307] cannot use erase() with number");
490 json j_nonobject(json::value_t::number_unsigned);
491 CHECK_THROWS_AS(j_nonobject.erase(0), json::type_error&);
493 … "[json.exception.type_error.307] cannot use erase() with number");
498 json j_nonobject(json::value_t::number_float);
499 CHECK_THROWS_AS(j_nonobject.erase(0), json::type_error&);
501 … "[json.exception.type_error.307] cannot use erase() with number");
514 json j;
515 CHECK_THROWS_AS(j.front(), json::invalid_iterator&);
516 CHECK_THROWS_AS(j.back(), json::invalid_iterator&);
517 … CHECK_THROWS_WITH(j.front(), "[json.exception.invalid_iterator.214] cannot get value");
518 … CHECK_THROWS_WITH(j.back(), "[json.exception.invalid_iterator.214] cannot get value");
521 const json j{};
522 CHECK_THROWS_AS(j.front(), json::invalid_iterator&);
523 CHECK_THROWS_AS(j.back(), json::invalid_iterator&);
524 … CHECK_THROWS_WITH(j.front(), "[json.exception.invalid_iterator.214] cannot get value");
525 … CHECK_THROWS_WITH(j.back(), "[json.exception.invalid_iterator.214] cannot get value");
532 json j = "foo";
537 const json j = "bar";
546 json j = false;
551 const json j = true;
560 json j = 17;
565 const json j = 17;
574 json j = 17u;
579 const json j = 17u;
588 json j = 23.42;
593 const json j = 23.42;
605 json j;
606 CHECK_THROWS_AS(j.erase(j.begin()), json::type_error&);
608 … "[json.exception.type_error.307] cannot use erase() with null");
611 json j;
612 CHECK_THROWS_AS(j.erase(j.cbegin()), json::type_error&);
614 … "[json.exception.type_error.307] cannot use erase() with null");
621 json j = "foo";
622 json::iterator it = j.erase(j.begin());
623 CHECK(j.type() == json::value_t::null);
627 json j = "bar";
628 json::const_iterator it = j.erase(j.cbegin());
629 CHECK(j.type() == json::value_t::null);
637 json j = false;
638 json::iterator it = j.erase(j.begin());
639 CHECK(j.type() == json::value_t::null);
643 json j = true;
644 json::const_iterator it = j.erase(j.cbegin());
645 CHECK(j.type() == json::value_t::null);
653 json j = 17;
654 json::iterator it = j.erase(j.begin());
655 CHECK(j.type() == json::value_t::null);
659 json j = 17;
660 json::const_iterator it = j.erase(j.cbegin());
661 CHECK(j.type() == json::value_t::null);
669 json j = 17u;
670 json::iterator it = j.erase(j.begin());
671 CHECK(j.type() == json::value_t::null);
675 json j = 17u;
676 json::const_iterator it = j.erase(j.cbegin());
677 CHECK(j.type() == json::value_t::null);
685 json j = 23.42;
686 json::iterator it = j.erase(j.begin());
687 CHECK(j.type() == json::value_t::null);
691 json j = 23.42;
692 json::const_iterator it = j.erase(j.cbegin());
693 CHECK(j.type() == json::value_t::null);
701 json j = json::binary({1, 2, 3});
702 json::iterator it = j.erase(j.begin());
703 CHECK(j.type() == json::value_t::null);
707 json j = json::binary({1, 2, 3});
708 json::const_iterator it = j.erase(j.cbegin());
709 CHECK(j.type() == json::value_t::null);
720 json j = "foo";
721 CHECK_THROWS_AS(j.erase(j.end()), json::invalid_iterator&);
723 … "[json.exception.invalid_iterator.205] iterator out of range");
726 json j = "bar";
727 CHECK_THROWS_AS(j.erase(j.cend()), json::invalid_iterator&);
729 … "[json.exception.invalid_iterator.205] iterator out of range");
736 json j = false;
737 CHECK_THROWS_AS(j.erase(j.end()), json::invalid_iterator&);
739 … "[json.exception.invalid_iterator.205] iterator out of range");
742 json j = true;
743 CHECK_THROWS_AS(j.erase(j.cend()), json::invalid_iterator&);
745 … "[json.exception.invalid_iterator.205] iterator out of range");
752 json j = 17;
753 CHECK_THROWS_AS(j.erase(j.end()), json::invalid_iterator&);
755 … "[json.exception.invalid_iterator.205] iterator out of range");
758 json j = 17;
759 CHECK_THROWS_AS(j.erase(j.cend()), json::invalid_iterator&);
761 … "[json.exception.invalid_iterator.205] iterator out of range");
768 json j = 17u;
769 CHECK_THROWS_AS(j.erase(j.end()), json::invalid_iterator&);
771 … "[json.exception.invalid_iterator.205] iterator out of range");
774 json j = 17u;
775 CHECK_THROWS_AS(j.erase(j.cend()), json::invalid_iterator&);
777 … "[json.exception.invalid_iterator.205] iterator out of range");
784 json j = 23.42;
785 CHECK_THROWS_AS(j.erase(j.end()), json::invalid_iterator&);
787 … "[json.exception.invalid_iterator.205] iterator out of range");
790 json j = 23.42;
791 CHECK_THROWS_AS(j.erase(j.cend()), json::invalid_iterator&);
793 … "[json.exception.invalid_iterator.205] iterator out of range");
803 json j;
804 CHECK_THROWS_AS(j.erase(j.begin(), j.end()), json::type_error&);
806 … "[json.exception.type_error.307] cannot use erase() with null");
809 json j;
810 CHECK_THROWS_AS(j.erase(j.cbegin(), j.cend()), json::type_error&);
812 … "[json.exception.type_error.307] cannot use erase() with null");
819 json j = "foo";
820 json::iterator it = j.erase(j.begin(), j.end());
821 CHECK(j.type() == json::value_t::null);
825 json j = "bar";
826 json::const_iterator it = j.erase(j.cbegin(), j.cend());
827 CHECK(j.type() == json::value_t::null);
835 json j = false;
836 json::iterator it = j.erase(j.begin(), j.end());
837 CHECK(j.type() == json::value_t::null);
841 json j = true;
842 json::const_iterator it = j.erase(j.cbegin(), j.cend());
843 CHECK(j.type() == json::value_t::null);
851 json j = 17;
852 json::iterator it = j.erase(j.begin(), j.end());
853 CHECK(j.type() == json::value_t::null);
857 json j = 17;
858 json::const_iterator it = j.erase(j.cbegin(), j.cend());
859 CHECK(j.type() == json::value_t::null);
867 json j = 17u;
868 json::iterator it = j.erase(j.begin(), j.end());
869 CHECK(j.type() == json::value_t::null);
873 json j = 17u;
874 json::const_iterator it = j.erase(j.cbegin(), j.cend());
875 CHECK(j.type() == json::value_t::null);
883 json j = 23.42;
884 json::iterator it = j.erase(j.begin(), j.end());
885 CHECK(j.type() == json::value_t::null);
889 json j = 23.42;
890 json::const_iterator it = j.erase(j.cbegin(), j.cend());
891 CHECK(j.type() == json::value_t::null);
899 json j = json::binary({1, 2, 3});
900 json::iterator it = j.erase(j.begin(), j.end());
901 CHECK(j.type() == json::value_t::null);
905 json j = json::binary({1, 2, 3});
906 json::const_iterator it = j.erase(j.cbegin(), j.cend());
907 CHECK(j.type() == json::value_t::null);
918 json j = "foo";
919 CHECK_THROWS_AS(j.erase(j.end(), j.end()), json::invalid_iterator&);
920 CHECK_THROWS_AS(j.erase(j.begin(), j.begin()), json::invalid_iterator&);
921 …CHECK_THROWS_WITH(j.erase(j.end(), j.end()), "[json.exception.invalid_iterator.204] iterators out …
922 …CHECK_THROWS_WITH(j.erase(j.begin(), j.begin()), "[json.exception.invalid_iterator.204] iterators …
925 json j = "bar";
926 CHECK_THROWS_AS(j.erase(j.cend(), j.cend()), json::invalid_iterator&);
927 CHECK_THROWS_AS(j.erase(j.cbegin(), j.cbegin()), json::invalid_iterator&);
928 …CHECK_THROWS_WITH(j.erase(j.cend(), j.cend()), "[json.exception.invalid_iterator.204] iterators ou…
929 …CHECK_THROWS_WITH(j.erase(j.cbegin(), j.cbegin()), "[json.exception.invalid_iterator.204] iterator…
936 json j = false;
937 CHECK_THROWS_AS(j.erase(j.end(), j.end()), json::invalid_iterator&);
938 CHECK_THROWS_AS(j.erase(j.begin(), j.begin()), json::invalid_iterator&);
939 …CHECK_THROWS_WITH(j.erase(j.end(), j.end()), "[json.exception.invalid_iterator.204] iterators out …
940 …CHECK_THROWS_WITH(j.erase(j.begin(), j.begin()), "[json.exception.invalid_iterator.204] iterators …
943 json j = true;
944 CHECK_THROWS_AS(j.erase(j.cend(), j.cend()), json::invalid_iterator&);
945 CHECK_THROWS_AS(j.erase(j.cbegin(), j.cbegin()), json::invalid_iterator&);
946 …CHECK_THROWS_WITH(j.erase(j.cend(), j.cend()), "[json.exception.invalid_iterator.204] iterators ou…
947 …CHECK_THROWS_WITH(j.erase(j.cbegin(), j.cbegin()), "[json.exception.invalid_iterator.204] iterator…
954 json j = 17;
955 CHECK_THROWS_AS(j.erase(j.end(), j.end()), json::invalid_iterator&);
956 CHECK_THROWS_AS(j.erase(j.begin(), j.begin()), json::invalid_iterator&);
957 …CHECK_THROWS_WITH(j.erase(j.end(), j.end()), "[json.exception.invalid_iterator.204] iterators out …
958 …CHECK_THROWS_WITH(j.erase(j.begin(), j.begin()), "[json.exception.invalid_iterator.204] iterators …
961 json j = 17;
962 CHECK_THROWS_AS(j.erase(j.cend(), j.cend()), json::invalid_iterator&);
963 CHECK_THROWS_AS(j.erase(j.cbegin(), j.cbegin()), json::invalid_iterator&);
964 …CHECK_THROWS_WITH(j.erase(j.cend(), j.cend()), "[json.exception.invalid_iterator.204] iterators ou…
965 …CHECK_THROWS_WITH(j.erase(j.cbegin(), j.cbegin()), "[json.exception.invalid_iterator.204] iterator…
972 json j = 17u;
973 CHECK_THROWS_AS(j.erase(j.end(), j.end()), json::invalid_iterator&);
974 CHECK_THROWS_AS(j.erase(j.begin(), j.begin()), json::invalid_iterator&);
975 …CHECK_THROWS_WITH(j.erase(j.end(), j.end()), "[json.exception.invalid_iterator.204] iterators out …
976 …CHECK_THROWS_WITH(j.erase(j.begin(), j.begin()), "[json.exception.invalid_iterator.204] iterators …
979 json j = 17u;
980 CHECK_THROWS_AS(j.erase(j.cend(), j.cend()), json::invalid_iterator&);
981 CHECK_THROWS_AS(j.erase(j.cbegin(), j.cbegin()), json::invalid_iterator&);
982 …CHECK_THROWS_WITH(j.erase(j.cend(), j.cend()), "[json.exception.invalid_iterator.204] iterators ou…
983 …CHECK_THROWS_WITH(j.erase(j.cbegin(), j.cbegin()), "[json.exception.invalid_iterator.204] iterator…
990 json j = 23.42;
991 CHECK_THROWS_AS(j.erase(j.end(), j.end()), json::invalid_iterator&);
992 CHECK_THROWS_AS(j.erase(j.begin(), j.begin()), json::invalid_iterator&);
993 …CHECK_THROWS_WITH(j.erase(j.end(), j.end()), "[json.exception.invalid_iterator.204] iterators out …
994 …CHECK_THROWS_WITH(j.erase(j.begin(), j.begin()), "[json.exception.invalid_iterator.204] iterators …
997 json j = 23.42;
998 CHECK_THROWS_AS(j.erase(j.cend(), j.cend()), json::invalid_iterator&);
999 CHECK_THROWS_AS(j.erase(j.cbegin(), j.cbegin()), json::invalid_iterator&);
1000 …CHECK_THROWS_WITH(j.erase(j.cend(), j.cend()), "[json.exception.invalid_iterator.204] iterators ou…
1001 …CHECK_THROWS_WITH(j.erase(j.cbegin(), j.cbegin()), "[json.exception.invalid_iterator.204] iterator…