Lines Matching full:json
3 __| | __| | | | JSON for Modern C++ (test suite)
5 |_____|_____|_____|_|___| https://github.com/nlohmann/json
33 #include <nlohmann/json.hpp>
34 using nlohmann::json;
56 bool number_integer(json::number_integer_t val) in number_integer()
62 bool number_unsigned(json::number_unsigned_t val) in number_unsigned()
68 bool number_float(json::number_float_t, const std::string& s) in number_float()
80 bool binary(json::binary_t& val) in binary()
139 bool parse_error(std::size_t position, const std::string&, const json::exception&) in parse_error()
150 class SaxCountdown : public nlohmann::json::json_sax_t
166 bool number_integer(json::number_integer_t) override in number_integer()
171 bool number_unsigned(json::number_unsigned_t) override in number_unsigned()
176 bool number_float(json::number_float_t, const std::string&) override in number_float()
186 bool binary(json::binary_t&) override in binary()
216 bool parse_error(std::size_t, const std::string&, const json::exception&) override in parse_error()
225 json parser_helper(const std::string& s);
229 json parser_helper(const std::string& s) in parser_helper()
231 json j; in parser_helper()
232 json::parser(nlohmann::detail::input_adapter(s)).parse(true, j); in parser_helper()
236 json j_nothrow; in parser_helper()
237 …CHECK_NOTHROW(json::parser(nlohmann::detail::input_adapter(s), nullptr, false).parse(true, j_nothr… in parser_helper()
240 json j_sax; in parser_helper()
241 nlohmann::detail::json_sax_dom_parser<json> sdp(j_sax); in parser_helper()
242 json::sax_parse(s, &sdp); in parser_helper()
255 json j; in accept_helper()
256 CHECK_NOTHROW(json::parser(nlohmann::detail::input_adapter(s), nullptr, false).parse(true, j)); in accept_helper()
260 const bool ok_accept = json::parser(nlohmann::detail::input_adapter(s)).accept(true); in accept_helper()
267 CHECK_NOTHROW(json::sax_parse(s, &el, json::input_format_t::json, false)); in accept_helper()
268 CHECK(json::parser(nlohmann::detail::input_adapter(s)).accept(false) == !el.errored); in accept_helper()
271 json::parser_callback_t cb = [](int, json::parse_event_t, json&) in accept_helper()
275 json j_cb = json::parse(s, cb, false); in accept_helper()
293 json _; in comments_helper()
296 CHECK_NOTHROW(_ = json::parse(s)); in comments_helper()
297 CHECK(json::accept(s)); in comments_helper()
300 CHECK_NOTHROW(_ = json::parse(s, nullptr, false, true)); in comments_helper()
301 CHECK(json::accept(s, true)); in comments_helper()
316 CHECK_THROWS_AS(_ = json::parse(json_with_comment), json::parse_error); in comments_helper()
317 CHECK(!json::accept(json_with_comment)); in comments_helper()
319 CHECK_NOTHROW(_ = json::parse(json_with_comment, nullptr, true, true)); in comments_helper()
320 CHECK(json::accept(json_with_comment, true)); in comments_helper()
332 CHECK(parser_helper("null") == json(nullptr));
337 CHECK(parser_helper("true") == json(true));
342 CHECK(parser_helper("false") == json(false));
349 CHECK(parser_helper("[]") == json(json::value_t::array));
350 CHECK(parser_helper("[ ]") == json(json::value_t::array));
355 CHECK(parser_helper("[true, false, null]") == json({true, false, nullptr}));
363 CHECK(parser_helper("{}") == json(json::value_t::object));
364 CHECK(parser_helper("{ }") == json(json::value_t::object));
369 …CHECK(parser_helper("{\"\": true, \"one\": 1, \"two\": null}") == json({{"", true}, {"one", 1}, {"…
376 CHECK(parser_helper("\"\"") == json(json::value_t::string));
381 CHECK_THROWS_AS(parser_helper("\"\t\""), json::parse_error&);
383 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
385 CHECK_THROWS_AS(parser_helper("\"\n\""), json::parse_error&);
386 CHECK_THROWS_AS(parser_helper("\"\r\""), json::parse_error&);
388 …"[json.exception.parse_error.101] parse error at line 2, column 0: syntax error while parsing valu…
390 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
392 CHECK_THROWS_AS(parser_helper("\"\b\""), json::parse_error&);
394 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
396 CHECK_THROWS_AS(parser_helper("\uFF01"), json::parse_error&);
397 CHECK_THROWS_AS(parser_helper("[-4:1,]"), json::parse_error&);
399 CHECK_THROWS_AS(parser_helper("\"\x00\""), json::parse_error&);
400 CHECK_THROWS_AS(parser_helper("\"\x01\""), json::parse_error&);
401 CHECK_THROWS_AS(parser_helper("\"\x02\""), json::parse_error&);
402 CHECK_THROWS_AS(parser_helper("\"\x03\""), json::parse_error&);
403 CHECK_THROWS_AS(parser_helper("\"\x04\""), json::parse_error&);
404 CHECK_THROWS_AS(parser_helper("\"\x05\""), json::parse_error&);
405 CHECK_THROWS_AS(parser_helper("\"\x06\""), json::parse_error&);
406 CHECK_THROWS_AS(parser_helper("\"\x07\""), json::parse_error&);
407 CHECK_THROWS_AS(parser_helper("\"\x08\""), json::parse_error&);
408 CHECK_THROWS_AS(parser_helper("\"\x09\""), json::parse_error&);
409 CHECK_THROWS_AS(parser_helper("\"\x0a\""), json::parse_error&);
410 CHECK_THROWS_AS(parser_helper("\"\x0b\""), json::parse_error&);
411 CHECK_THROWS_AS(parser_helper("\"\x0c\""), json::parse_error&);
412 CHECK_THROWS_AS(parser_helper("\"\x0d\""), json::parse_error&);
413 CHECK_THROWS_AS(parser_helper("\"\x0e\""), json::parse_error&);
414 CHECK_THROWS_AS(parser_helper("\"\x0f\""), json::parse_error&);
415 CHECK_THROWS_AS(parser_helper("\"\x10\""), json::parse_error&);
416 CHECK_THROWS_AS(parser_helper("\"\x11\""), json::parse_error&);
417 CHECK_THROWS_AS(parser_helper("\"\x12\""), json::parse_error&);
418 CHECK_THROWS_AS(parser_helper("\"\x13\""), json::parse_error&);
419 CHECK_THROWS_AS(parser_helper("\"\x14\""), json::parse_error&);
420 CHECK_THROWS_AS(parser_helper("\"\x15\""), json::parse_error&);
421 CHECK_THROWS_AS(parser_helper("\"\x16\""), json::parse_error&);
422 CHECK_THROWS_AS(parser_helper("\"\x17\""), json::parse_error&);
423 CHECK_THROWS_AS(parser_helper("\"\x18\""), json::parse_error&);
424 CHECK_THROWS_AS(parser_helper("\"\x19\""), json::parse_error&);
425 CHECK_THROWS_AS(parser_helper("\"\x1a\""), json::parse_error&);
426 CHECK_THROWS_AS(parser_helper("\"\x1b\""), json::parse_error&);
427 CHECK_THROWS_AS(parser_helper("\"\x1c\""), json::parse_error&);
428 CHECK_THROWS_AS(parser_helper("\"\x1d\""), json::parse_error&);
429 CHECK_THROWS_AS(parser_helper("\"\x1e\""), json::parse_error&);
430 CHECK_THROWS_AS(parser_helper("\"\x1f\""), json::parse_error&);
431 …CHECK_THROWS_WITH(parser_helper("\"\x00\""), "[json.exception.parse_error.101] parse error at line…
432 …CHECK_THROWS_WITH(parser_helper("\"\x01\""), "[json.exception.parse_error.101] parse error at line…
433 …CHECK_THROWS_WITH(parser_helper("\"\x02\""), "[json.exception.parse_error.101] parse error at line…
434 …CHECK_THROWS_WITH(parser_helper("\"\x03\""), "[json.exception.parse_error.101] parse error at line…
435 …CHECK_THROWS_WITH(parser_helper("\"\x04\""), "[json.exception.parse_error.101] parse error at line…
436 …CHECK_THROWS_WITH(parser_helper("\"\x05\""), "[json.exception.parse_error.101] parse error at line…
437 …CHECK_THROWS_WITH(parser_helper("\"\x06\""), "[json.exception.parse_error.101] parse error at line…
438 …CHECK_THROWS_WITH(parser_helper("\"\x07\""), "[json.exception.parse_error.101] parse error at line…
439 …CHECK_THROWS_WITH(parser_helper("\"\x08\""), "[json.exception.parse_error.101] parse error at line…
440 …CHECK_THROWS_WITH(parser_helper("\"\x09\""), "[json.exception.parse_error.101] parse error at line…
441 …CHECK_THROWS_WITH(parser_helper("\"\x0a\""), "[json.exception.parse_error.101] parse error at line…
442 …CHECK_THROWS_WITH(parser_helper("\"\x0b\""), "[json.exception.parse_error.101] parse error at line…
443 …CHECK_THROWS_WITH(parser_helper("\"\x0c\""), "[json.exception.parse_error.101] parse error at line…
444 …CHECK_THROWS_WITH(parser_helper("\"\x0d\""), "[json.exception.parse_error.101] parse error at line…
445 …CHECK_THROWS_WITH(parser_helper("\"\x0e\""), "[json.exception.parse_error.101] parse error at line…
446 …CHECK_THROWS_WITH(parser_helper("\"\x0f\""), "[json.exception.parse_error.101] parse error at line…
447 …CHECK_THROWS_WITH(parser_helper("\"\x10\""), "[json.exception.parse_error.101] parse error at line…
448 …CHECK_THROWS_WITH(parser_helper("\"\x11\""), "[json.exception.parse_error.101] parse error at line…
449 …CHECK_THROWS_WITH(parser_helper("\"\x12\""), "[json.exception.parse_error.101] parse error at line…
450 …CHECK_THROWS_WITH(parser_helper("\"\x13\""), "[json.exception.parse_error.101] parse error at line…
451 …CHECK_THROWS_WITH(parser_helper("\"\x14\""), "[json.exception.parse_error.101] parse error at line…
452 …CHECK_THROWS_WITH(parser_helper("\"\x15\""), "[json.exception.parse_error.101] parse error at line…
453 …CHECK_THROWS_WITH(parser_helper("\"\x16\""), "[json.exception.parse_error.101] parse error at line…
454 …CHECK_THROWS_WITH(parser_helper("\"\x17\""), "[json.exception.parse_error.101] parse error at line…
455 …CHECK_THROWS_WITH(parser_helper("\"\x18\""), "[json.exception.parse_error.101] parse error at line…
456 …CHECK_THROWS_WITH(parser_helper("\"\x19\""), "[json.exception.parse_error.101] parse error at line…
457 …CHECK_THROWS_WITH(parser_helper("\"\x1a\""), "[json.exception.parse_error.101] parse error at line…
458 …CHECK_THROWS_WITH(parser_helper("\"\x1b\""), "[json.exception.parse_error.101] parse error at line…
459 …CHECK_THROWS_WITH(parser_helper("\"\x1c\""), "[json.exception.parse_error.101] parse error at line…
460 …CHECK_THROWS_WITH(parser_helper("\"\x1d\""), "[json.exception.parse_error.101] parse error at line…
461 …CHECK_THROWS_WITH(parser_helper("\"\x1e\""), "[json.exception.parse_error.101] parse error at line…
462 …CHECK_THROWS_WITH(parser_helper("\"\x1f\""), "[json.exception.parse_error.101] parse error at line…
472 json _;
473 CHECK_THROWS_AS(_ = json::parse(s.begin(), s.end()), json::parse_error&);
474 …CHECK_THROWS_WITH(_ = json::parse(s.begin(), s.end()), "[json.exception.parse_error.101] parse err…
489 CHECK(parser_helper("\"\\b\"") == json("\b"));
491 CHECK(parser_helper("\"\\f\"") == json("\f"));
493 CHECK(parser_helper("\"\\n\"") == json("\n"));
495 CHECK(parser_helper("\"\\r\"") == json("\r"));
497 CHECK(parser_helper("\"\\t\"") == json("\t"));
499 CHECK(parser_helper("\"\\u0001\"").get<json::string_t>() == "\x01");
500 CHECK(parser_helper("\"\\u000a\"").get<json::string_t>() == "\n");
501 CHECK(parser_helper("\"\\u00b0\"").get<json::string_t>() == "°");
502 CHECK(parser_helper("\"\\u0c00\"").get<json::string_t>() == "ఀ");
503 CHECK(parser_helper("\"\\ud000\"").get<json::string_t>() == "퀀");
504 CHECK(parser_helper("\"\\u000E\"").get<json::string_t>() == "\x0E");
505 CHECK(parser_helper("\"\\u00F0\"").get<json::string_t>() == "ð");
506 CHECK(parser_helper("\"\\u0100\"").get<json::string_t>() == "Ā");
507 CHECK(parser_helper("\"\\u2000\"").get<json::string_t>() == " ");
508 CHECK(parser_helper("\"\\uFFFF\"").get<json::string_t>() == "");
509 CHECK(parser_helper("\"\\u20AC\"").get<json::string_t>() == "€");
510 CHECK(parser_helper("\"€\"").get<json::string_t>() == "€");
511 CHECK(parser_helper("\"\"").get<json::string_t>() == "");
513 CHECK(parser_helper("\"\\ud80c\\udc60\"").get<json::string_t>() == u8"\U00013060");
514 CHECK(parser_helper("\"\\ud83c\\udf1e\"").get<json::string_t>() == "");
524 CHECK(parser_helper("-128") == json(-128));
525 CHECK(parser_helper("-0") == json(-0));
526 CHECK(parser_helper("0") == json(0));
527 CHECK(parser_helper("128") == json(128));
532 CHECK(parser_helper("0e1") == json(0e1));
533 CHECK(parser_helper("0E1") == json(0e1));
535 CHECK(parser_helper("10000E-4") == json(10000e-4));
536 CHECK(parser_helper("10000E-3") == json(10000e-3));
537 CHECK(parser_helper("10000E-2") == json(10000e-2));
538 CHECK(parser_helper("10000E-1") == json(10000e-1));
539 CHECK(parser_helper("10000E0") == json(10000e0));
540 CHECK(parser_helper("10000E1") == json(10000e1));
541 CHECK(parser_helper("10000E2") == json(10000e2));
542 CHECK(parser_helper("10000E3") == json(10000e3));
543 CHECK(parser_helper("10000E4") == json(10000e4));
545 CHECK(parser_helper("10000e-4") == json(10000e-4));
546 CHECK(parser_helper("10000e-3") == json(10000e-3));
547 CHECK(parser_helper("10000e-2") == json(10000e-2));
548 CHECK(parser_helper("10000e-1") == json(10000e-1));
549 CHECK(parser_helper("10000e0") == json(10000e0));
550 CHECK(parser_helper("10000e1") == json(10000e1));
551 CHECK(parser_helper("10000e2") == json(10000e2));
552 CHECK(parser_helper("10000e3") == json(10000e3));
553 CHECK(parser_helper("10000e4") == json(10000e4));
555 CHECK(parser_helper("-0e1") == json(-0e1));
556 CHECK(parser_helper("-0E1") == json(-0e1));
557 CHECK(parser_helper("-0E123") == json(-0e123));
560 CHECK(parser_helper("10E0") == json(10e0));
561 CHECK(parser_helper("10E1") == json(10e1));
562 CHECK(parser_helper("10E2") == json(10e2));
563 CHECK(parser_helper("10E3") == json(10e3));
564 CHECK(parser_helper("10E4") == json(10e4));
565 CHECK(parser_helper("10E5") == json(10e5));
566 CHECK(parser_helper("10E6") == json(10e6));
567 CHECK(parser_helper("10E7") == json(10e7));
568 CHECK(parser_helper("10E8") == json(10e8));
569 CHECK(parser_helper("10E9") == json(10e9));
570 CHECK(parser_helper("10E+0") == json(10e0));
571 CHECK(parser_helper("10E+1") == json(10e1));
572 CHECK(parser_helper("10E+2") == json(10e2));
573 CHECK(parser_helper("10E+3") == json(10e3));
574 CHECK(parser_helper("10E+4") == json(10e4));
575 CHECK(parser_helper("10E+5") == json(10e5));
576 CHECK(parser_helper("10E+6") == json(10e6));
577 CHECK(parser_helper("10E+7") == json(10e7));
578 CHECK(parser_helper("10E+8") == json(10e8));
579 CHECK(parser_helper("10E+9") == json(10e9));
580 CHECK(parser_helper("10E-1") == json(10e-1));
581 CHECK(parser_helper("10E-2") == json(10e-2));
582 CHECK(parser_helper("10E-3") == json(10e-3));
583 CHECK(parser_helper("10E-4") == json(10e-4));
584 CHECK(parser_helper("10E-5") == json(10e-5));
585 CHECK(parser_helper("10E-6") == json(10e-6));
586 CHECK(parser_helper("10E-7") == json(10e-7));
587 CHECK(parser_helper("10E-8") == json(10e-8));
588 CHECK(parser_helper("10E-9") == json(10e-9));
627 CHECK(parser_helper("-128.5") == json(-128.5));
628 CHECK(parser_helper("0.999") == json(0.999));
629 CHECK(parser_helper("128.5") == json(128.5));
630 CHECK(parser_helper("-0.0") == json(-0.0));
635 CHECK(parser_helper("-128.5E3") == json(-128.5E3));
636 CHECK(parser_helper("-128.5E-3") == json(-128.5E-3));
637 CHECK(parser_helper("-0.0e1") == json(-0.0e1));
638 CHECK(parser_helper("-0.0E1") == json(-0.0e1));
645 CHECK_THROWS_AS(parser_helper("1.18973e+4932") == json(), json::out_of_range&);
646 CHECK_THROWS_WITH(parser_helper("1.18973e+4932") == json(),
647 … "[json.exception.out_of_range.406] number overflow parsing '1.18973e+4932'");
652 CHECK_THROWS_AS(parser_helper("01"), json::parse_error&);
653 CHECK_THROWS_AS(parser_helper("--1"), json::parse_error&);
654 CHECK_THROWS_AS(parser_helper("1."), json::parse_error&);
655 CHECK_THROWS_AS(parser_helper("1E"), json::parse_error&);
656 CHECK_THROWS_AS(parser_helper("1E-"), json::parse_error&);
657 CHECK_THROWS_AS(parser_helper("1.E1"), json::parse_error&);
658 CHECK_THROWS_AS(parser_helper("-1E"), json::parse_error&);
659 CHECK_THROWS_AS(parser_helper("-0E#"), json::parse_error&);
660 CHECK_THROWS_AS(parser_helper("-0E-#"), json::parse_error&);
661 CHECK_THROWS_AS(parser_helper("-0#"), json::parse_error&);
662 CHECK_THROWS_AS(parser_helper("-0.0:"), json::parse_error&);
663 CHECK_THROWS_AS(parser_helper("-0.0Z"), json::parse_error&);
664 CHECK_THROWS_AS(parser_helper("-0E123:"), json::parse_error&);
665 CHECK_THROWS_AS(parser_helper("-0e0-:"), json::parse_error&);
666 CHECK_THROWS_AS(parser_helper("-0e-:"), json::parse_error&);
667 CHECK_THROWS_AS(parser_helper("-0f"), json::parse_error&);
670 CHECK_THROWS_AS(parser_helper("+1"), json::parse_error&);
671 CHECK_THROWS_AS(parser_helper("+0"), json::parse_error&);
674 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
676 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
678 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
680 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
682 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
684 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
686 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
688 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
690 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
692 …"[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing valu…
694 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
696 …"[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing valu…
698 …"[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing valu…
700 …"[json.exception.parse_error.101] parse error at line 1, column 7: syntax error while parsing valu…
702 …"[json.exception.parse_error.101] parse error at line 1, column 6: syntax error while parsing valu…
704 …"[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing valu…
706 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
976 CHECK_THROWS_AS(parser_helper("0."), json::parse_error&);
977 CHECK_THROWS_AS(parser_helper("-"), json::parse_error&);
978 CHECK_THROWS_AS(parser_helper("--"), json::parse_error&);
979 CHECK_THROWS_AS(parser_helper("-0."), json::parse_error&);
980 CHECK_THROWS_AS(parser_helper("-."), json::parse_error&);
981 CHECK_THROWS_AS(parser_helper("-:"), json::parse_error&);
982 CHECK_THROWS_AS(parser_helper("0.:"), json::parse_error&);
983 CHECK_THROWS_AS(parser_helper("e."), json::parse_error&);
984 CHECK_THROWS_AS(parser_helper("1e."), json::parse_error&);
985 CHECK_THROWS_AS(parser_helper("1e/"), json::parse_error&);
986 CHECK_THROWS_AS(parser_helper("1e:"), json::parse_error&);
987 CHECK_THROWS_AS(parser_helper("1E."), json::parse_error&);
988 CHECK_THROWS_AS(parser_helper("1E/"), json::parse_error&);
989 CHECK_THROWS_AS(parser_helper("1E:"), json::parse_error&);
991 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
993 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
995 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
997 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
999 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
1001 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
1003 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
1005 …"[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing valu…
1007 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
1009 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
1011 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
1013 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
1015 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
1017 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
1020 CHECK_THROWS_AS(parser_helper("n"), json::parse_error&);
1021 CHECK_THROWS_AS(parser_helper("nu"), json::parse_error&);
1022 CHECK_THROWS_AS(parser_helper("nul"), json::parse_error&);
1023 CHECK_THROWS_AS(parser_helper("nulk"), json::parse_error&);
1024 CHECK_THROWS_AS(parser_helper("nulm"), json::parse_error&);
1026 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
1028 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
1030 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
1032 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
1034 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
1037 CHECK_THROWS_AS(parser_helper("t"), json::parse_error&);
1038 CHECK_THROWS_AS(parser_helper("tr"), json::parse_error&);
1039 CHECK_THROWS_AS(parser_helper("tru"), json::parse_error&);
1040 CHECK_THROWS_AS(parser_helper("trud"), json::parse_error&);
1041 CHECK_THROWS_AS(parser_helper("truf"), json::parse_error&);
1043 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
1045 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
1047 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
1049 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
1051 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
1054 CHECK_THROWS_AS(parser_helper("f"), json::parse_error&);
1055 CHECK_THROWS_AS(parser_helper("fa"), json::parse_error&);
1056 CHECK_THROWS_AS(parser_helper("fal"), json::parse_error&);
1057 CHECK_THROWS_AS(parser_helper("fals"), json::parse_error&);
1058 CHECK_THROWS_AS(parser_helper("falsd"), json::parse_error&);
1059 CHECK_THROWS_AS(parser_helper("falsf"), json::parse_error&);
1061 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
1063 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
1065 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
1067 …"[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing valu…
1069 …"[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing valu…
1071 …"[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing valu…
1074 CHECK_THROWS_AS(parser_helper("["), json::parse_error&);
1075 CHECK_THROWS_AS(parser_helper("[1"), json::parse_error&);
1076 CHECK_THROWS_AS(parser_helper("[1,"), json::parse_error&);
1077 CHECK_THROWS_AS(parser_helper("[1,]"), json::parse_error&);
1078 CHECK_THROWS_AS(parser_helper("]"), json::parse_error&);
1080 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
1082 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing arra…
1084 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
1086 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
1088 …"[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing valu…
1091 CHECK_THROWS_AS(parser_helper("{"), json::parse_error&);
1092 CHECK_THROWS_AS(parser_helper("{\"foo\""), json::parse_error&);
1093 CHECK_THROWS_AS(parser_helper("{\"foo\":"), json::parse_error&);
1094 CHECK_THROWS_AS(parser_helper("{\"foo\":}"), json::parse_error&);
1095 CHECK_THROWS_AS(parser_helper("{\"foo\":1,}"), json::parse_error&);
1096 CHECK_THROWS_AS(parser_helper("}"), json::parse_error&);
1098 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing obje…
1100 …"[json.exception.parse_error.101] parse error at line 1, column 7: syntax error while parsing obje…
1102 …"[json.exception.parse_error.101] parse error at line 1, column 8: syntax error while parsing valu…
1104 …"[json.exception.parse_error.101] parse error at line 1, column 8: syntax error while parsing valu…
1106 …"[json.exception.parse_error.101] parse error at line 1, column 10: syntax error while parsing obj…
1108 …"[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing valu…
1111 CHECK_THROWS_AS(parser_helper("\""), json::parse_error&);
1112 CHECK_THROWS_AS(parser_helper("\"\\\""), json::parse_error&);
1113 CHECK_THROWS_AS(parser_helper("\"\\u\""), json::parse_error&);
1114 CHECK_THROWS_AS(parser_helper("\"\\u0\""), json::parse_error&);
1115 CHECK_THROWS_AS(parser_helper("\"\\u01\""), json::parse_error&);
1116 CHECK_THROWS_AS(parser_helper("\"\\u012\""), json::parse_error&);
1117 CHECK_THROWS_AS(parser_helper("\"\\u"), json::parse_error&);
1118 CHECK_THROWS_AS(parser_helper("\"\\u0"), json::parse_error&);
1119 CHECK_THROWS_AS(parser_helper("\"\\u01"), json::parse_error&);
1120 CHECK_THROWS_AS(parser_helper("\"\\u012"), json::parse_error&);
1122 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing valu…
1124 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
1126 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
1128 …"[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing valu…
1130 …"[json.exception.parse_error.101] parse error at line 1, column 6: syntax error while parsing valu…
1132 …"[json.exception.parse_error.101] parse error at line 1, column 7: syntax error while parsing valu…
1134 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
1136 …"[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing valu…
1138 …"[json.exception.parse_error.101] parse error at line 1, column 6: syntax error while parsing valu…
1140 …"[json.exception.parse_error.101] parse error at line 1, column 7: syntax error while parsing valu…
1172 CHECK_THROWS_AS(parser_helper(s.c_str()), json::parse_error&);
1177 …"[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing valu…
1248 CHECK_THROWS_AS(parser_helper(s1.c_str()), json::parse_error&);
1253 …"[json.exception.parse_error.101] parse error at line 1, column 7: syntax error while parsing valu…
1257 CHECK_THROWS_AS(parser_helper(s2.c_str()), json::parse_error&);
1262 …"[json.exception.parse_error.101] parse error at line 1, column 6: syntax error while parsing valu…
1266 CHECK_THROWS_AS(parser_helper(s3.c_str()), json::parse_error&);
1271 …"[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing valu…
1275 CHECK_THROWS_AS(parser_helper(s4.c_str()), json::parse_error&);
1280 …"[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing valu…
1286 json _;
1289 CHECK_THROWS_AS(_ = json::parse("\"\\uD80C\""), json::parse_error&);
1290 CHECK_THROWS_WITH(_ = json::parse("\"\\uD80C\""),
1291 …"[json.exception.parse_error.101] parse error at line 1, column 8: syntax error while parsing valu…
1293 CHECK_THROWS_AS(_ = json::parse("\"\\uD80C\\uD80C\""), json::parse_error&);
1294 CHECK_THROWS_AS(_ = json::parse("\"\\uD80C\\u0000\""), json::parse_error&);
1295 CHECK_THROWS_AS(_ = json::parse("\"\\uD80C\\uFFFF\""), json::parse_error&);
1296 CHECK_THROWS_WITH(_ = json::parse("\"\\uD80C\\uD80C\""),
1297 …"[json.exception.parse_error.101] parse error at line 1, column 13: syntax error while parsing val…
1298 CHECK_THROWS_WITH(_ = json::parse("\"\\uD80C\\u0000\""),
1299 …"[json.exception.parse_error.101] parse error at line 1, column 13: syntax error while parsing val…
1300 CHECK_THROWS_WITH(_ = json::parse("\"\\uD80C\\uFFFF\""),
1301 …"[json.exception.parse_error.101] parse error at line 1, column 13: syntax error while parsing val…
1385 … CHECK(json::parser(nlohmann::detail::input_adapter(std::string(s.c_str()))).accept());
1398 … CHECK(json::parser(nlohmann::detail::input_adapter(std::string(s.c_str()))).accept() == false);
1457 … CHECK(json::parser(nlohmann::detail::input_adapter(std::string(s1.c_str()))).accept());
1459 … CHECK(json::parser(nlohmann::detail::input_adapter(std::string(s2.c_str()))).accept());
1461 … CHECK(json::parser(nlohmann::detail::input_adapter(std::string(s3.c_str()))).accept());
1463 … CHECK(json::parser(nlohmann::detail::input_adapter(std::string(s4.c_str()))).accept());
1468 … CHECK(json::parser(nlohmann::detail::input_adapter(std::string(s1.c_str()))).accept() == false);
1471 … CHECK(json::parser(nlohmann::detail::input_adapter(std::string(s2.c_str()))).accept() == false);
1474 … CHECK(json::parser(nlohmann::detail::input_adapter(std::string(s3.c_str()))).accept() == false);
1477 … CHECK(json::parser(nlohmann::detail::input_adapter(std::string(s4.c_str()))).accept() == false);
1493 CHECK_THROWS_AS(parser_helper("{,\"key\": false}"), json::parse_error&);
1495 …"[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing obje…
1497 CHECK_THROWS_AS(parser_helper("[{\"key\": false true]"), json::parse_error&);
1499 …"[json.exception.parse_error.101] parse error at line 1, column 19: syntax error while parsing obj…
1503 json::parser_callback_t cb = [](int, json::parse_event_t event, json&)
1505 if (event == json::parse_event_t::key) in __anonaacc11310502()
1515 json x = json::parse("{\"key\": false}", cb);
1516 CHECK(x == json::object());
1549 json j_object = json::parse(s_object, [](int, json::parse_event_t, const json&)
1554 CHECK (j_object == json({{"foo", 2}, {"bar", {{"baz", 1}}}}));
1556 json j_array = json::parse(s_array, [](int, json::parse_event_t, const json&) argument
1561 CHECK (j_array == json({1, 2, {3, 4, 5}, 4, 5}));
1566 json j_object = json::parse(s_object, [](int, json::parse_event_t, const json&) argument
1574 json j_array = json::parse(s_array, [](int, json::parse_event_t, const json&) argument
1585 json j_object = json::parse(s_object, [](int, json::parse_event_t, const json & j)
1588 if (j == json(2)) in __anonaacc11310a02()
1598 CHECK (j_object == json({{"bar", {{"baz", 1}}}}));
1600 json j_array = json::parse(s_array, [](int, json::parse_event_t, const json & j)
1602 if (j == json(2)) in __anonaacc11310b02()
1612 CHECK (j_array == json({1, {3, 4, 5}, 4, 5}));
1617 …json j_filtered1 = json::parse(structured_array, [](int, json::parse_event_t e, const json & parse…
1619 if (e == json::parse_event_t::object_end && parsed.contains("foo")) in __anonaacc11310c02()
1631 CHECK (j_filtered1 == json({1, {{"qux", "baz"}}}));
1633 …json j_filtered2 = json::parse(structured_array, [](int, json::parse_event_t e, const json& /*pars…
1635 if (e == json::parse_event_t::object_end) in __anonaacc11310d02()
1647 CHECK (j_filtered2 == json({1}));
1655 … json j_object = json::parse(s_object, [](int, json::parse_event_t e, const json&) argument
1658 if (e == json::parse_event_t::object_end && first) in __anonaacc11310e02()
1670 CHECK (j_object == json({{"foo", 2}}));
1674 json j_array = json::parse(s_array, [](int, json::parse_event_t e, const json&) argument
1677 if (e == json::parse_event_t::array_end && first) in __anonaacc11310f02()
1689 CHECK (j_array == json({1, 2, 4, 5}));
1700 json j_empty_object = json::parse("{}", [](int, json::parse_event_t e, const json&)
1702 if (e == json::parse_event_t::object_end) in __anonaacc11311002()
1711 CHECK(j_empty_object == json());
1713 json j_empty_array = json::parse("[]", [](int, json::parse_event_t e, const json&) argument
1715 if (e == json::parse_event_t::array_end) in __anonaacc11311102()
1724 CHECK(j_empty_array == json());
1733 json j;
1734 … json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
1735 CHECK(j == json(true));
1741 json j;
1742 … json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
1743 CHECK(j == json(true));
1749 json j;
1750 … json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
1751 CHECK(j == json(true));
1756 CHECK(parser_helper("true") == json(true));
1762 json j;
1763 … json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
1764 CHECK(j == json(true));
1770 json j;
1771 … json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
1772 CHECK(j == json(true));
1778 json j;
1779 … json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
1780 CHECK(j == json(true));
1788 json::parser_callback_t cb = [](int, json::parse_event_t, json&)
1793 CHECK(json::parse("{\"foo\": true:", cb, false).is_discarded());
1795 json _;
1796 CHECK_THROWS_AS(_ = json::parse("{\"foo\": true:", cb), json::parse_error&);
1797 CHECK_THROWS_WITH(_ = json::parse("{\"foo\": true:", cb),
1798 …"[json.exception.parse_error.101] parse error at line 1, column 13: syntax error while parsing obj…
1800 CHECK_THROWS_AS(_ = json::parse("1.18973e+4932", cb), json::out_of_range&);
1801 CHECK_THROWS_WITH(_ = json::parse("1.18973e+4932", cb),
1802 … "[json.exception.out_of_range.406] number overflow parsing '1.18973e+4932'");
1810 CHECK(json::sax_parse("{}", &s) == false);
1816 CHECK(json::sax_parse("{\"k1\": true}", &s) == false);
1822 CHECK(json::sax_parse("{\"k1\": true, \"k2\": false}", &s) == false);
1828 CHECK(json::sax_parse("[]", &s) == false);
1834 CHECK(json::sax_parse("[1]", &s) == false);
1840 CHECK(json::sax_parse("3.14", &s) == false);
1846 CHECK(json::sax_parse("false", &s) == false);
1852 CHECK(json::sax_parse("null", &s) == false);
1858 CHECK(json::sax_parse("true", &s) == false);
1864 CHECK(json::sax_parse("12", &s) == false);
1870 CHECK(json::sax_parse("-12", &s) == false);
1876 CHECK(json::sax_parse("\"foo\"", &s) == false);
1883 …json::parse("/a", nullptr, true, true), "[json.exception.parse_error.101] parse error at line 1, c…
1884 …json::parse("/*", nullptr, true, true), "[json.exception.parse_error.101] parse error at line 1, c…