• Home
  • Raw
  • Download

Lines Matching full:json

2 //  __|  |   __|     |   | |  JSON for Modern C++ (supporting code)
4 // |_____|_____|_____|_|___| https://github.com/nlohmann/json
11 #include <nlohmann/json.hpp>
12 using nlohmann::json;
41 bool number_integer(json::number_integer_t /*unused*/) in number_integer()
46 bool number_unsigned(json::number_unsigned_t /*unused*/) in number_unsigned()
51 bool number_float(json::number_float_t /*unused*/, const std::string& /*unused*/) in number_float()
91 …bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/, const json::exception& /*u… in parse_error()
108 json const j = json::value_t::discarded;
109 const auto result = json::to_cbor(j);
116 json const j = std::numeric_limits<json::number_float_t>::quiet_NaN();
118 const auto result = json::to_cbor(j);
125 json const j = std::numeric_limits<json::number_float_t>::infinity();
127 const auto result = json::to_cbor(j);
133 const json j = nullptr;
135 const auto result = json::to_cbor(j);
139 CHECK(json::from_cbor(result) == j);
140 CHECK(json::from_cbor(result, true, false) == j);
147 const json j = true;
149 const auto result = json::to_cbor(j);
153 CHECK(json::from_cbor(result) == j);
154 CHECK(json::from_cbor(result, true, false) == j);
159 const json j = false;
161 const auto result = json::to_cbor(j);
165 CHECK(json::from_cbor(result) == j);
166 CHECK(json::from_cbor(result, true, false) == j);
194 // create JSON value with integer number
195 const json j = i;
216 const auto result = json::to_cbor(j);
234 CHECK(json::from_cbor(result) == j);
235 CHECK(json::from_cbor(result, true, false) == j);
255 // create JSON value with integer number
256 const json j = i;
273 const auto result = json::to_cbor(j);
287 CHECK(json::from_cbor(result) == j);
288 CHECK(json::from_cbor(result, true, false) == j);
298 // create JSON value with integer number
299 const json j = i;
314 const auto result = json::to_cbor(j);
325 CHECK(json::from_cbor(result) == j);
326 CHECK(json::from_cbor(result, true, false) == j);
332 const json j = -9263;
335 const auto result = json::to_cbor(j);
342 CHECK(json::from_cbor(result) == j);
343 CHECK(json::from_cbor(result, true, false) == j);
352 // create JSON value with integer number
353 const json j = i;
366 const auto result = json::to_cbor(j);
375 CHECK(json::from_cbor(result) == j);
376 CHECK(json::from_cbor(result, true, false) == j);
386 // create JSON value with integer number
387 const json j = i;
399 const auto result = json::to_cbor(j);
407 CHECK(json::from_cbor(result) == j);
408 CHECK(json::from_cbor(result, true, false) == j);
418 // create JSON value with integer number
419 json j = -1;
420 … j.get_ref<json::number_integer_t&>() = static_cast<json::number_integer_t>(i);
432 const auto result = json::to_cbor(j);
440 CHECK(json::from_cbor(result) == j);
441 CHECK(json::from_cbor(result, true, false) == j);
451 // create JSON value with integer number
452 json j = -1;
453 … j.get_ref<json::number_integer_t&>() = static_cast<json::number_integer_t>(i);
466 const auto result = json::to_cbor(j);
475 CHECK(json::from_cbor(result) == j);
476 CHECK(json::from_cbor(result, true, false) == j);
486 // create JSON value with integer number
487 json j = -1;
488 … j.get_ref<json::number_integer_t&>() = static_cast<json::number_integer_t>(i);
502 const auto result = json::to_cbor(j);
512 CHECK(json::from_cbor(result) == j);
513 CHECK(json::from_cbor(result, true, false) == j);
526 // create JSON value with integer number
527 json j = -1;
528 … j.get_ref<json::number_integer_t&>() = static_cast<json::number_integer_t>(i);
544 const auto result = json::to_cbor(j);
557 CHECK(json::from_cbor(result) == j);
558 CHECK(json::from_cbor(result, true, false) == j);
571 // create JSON value with integer number
572 json j = -1;
573 … j.get_ref<json::number_integer_t&>() = static_cast<json::number_integer_t>(i);
593 const auto result = json::to_cbor(j);
610 CHECK(json::from_cbor(result) == j);
611 CHECK(json::from_cbor(result, true, false) == j);
621 // create JSON value with integer number
622 const json j = i;
636 const auto result = json::to_msgpack(j);
646 CHECK(json::from_msgpack(result) == j);
659 // create JSON value with unsigned integer number
660 const json j = i;
672 const auto result = json::to_cbor(j);
680 CHECK(json::from_cbor(result) == j);
681 CHECK(json::from_cbor(result, true, false) == j);
691 // create JSON value with unsigned integer number
692 const json j = i;
705 const auto result = json::to_cbor(j);
715 CHECK(json::from_cbor(result) == j);
716 CHECK(json::from_cbor(result, true, false) == j);
726 // create JSON value with unsigned integer number
727 const json j = i;
741 const auto result = json::to_cbor(j);
751 CHECK(json::from_cbor(result) == j);
752 CHECK(json::from_cbor(result, true, false) == j);
765 // create JSON value with unsigned integer number
766 const json j = i;
782 const auto result = json::to_cbor(j);
795 CHECK(json::from_cbor(result) == j);
796 CHECK(json::from_cbor(result, true, false) == j);
809 // create JSON value with integer number
810 const json j = i;
830 const auto result = json::to_cbor(j);
847 CHECK(json::from_cbor(result) == j);
848 CHECK(json::from_cbor(result, true, false) == j);
858 const json j = v;
863 const auto result = json::to_cbor(j);
867 CHECK(json::from_cbor(result) == j);
868 CHECK(json::from_cbor(result) == v);
870 CHECK(json::from_cbor(result, true, false) == j);
879 const json j = v;
884 const auto result = json::to_cbor(j);
887 CHECK(json::from_cbor(result) == j);
888 CHECK(json::from_cbor(result) == v);
893 const json j = v;
897 const auto result = json::to_cbor(j);
900 CHECK(json::from_cbor(result) == j);
901 CHECK(json::from_cbor(result) == v);
906 const json j = v;
910 const auto result = json::to_cbor(j);
913 CHECK(json::from_cbor(result) == j);
914 CHECK(json::from_cbor(result) == v);
919 const json j = v;
923 const auto result = json::to_cbor(j);
926 CHECK(json::from_cbor(result) == j);
927 CHECK(json::from_cbor(result) == v);
932 const json j = v;
936 const auto result = json::to_cbor(j);
939 CHECK(json::from_cbor(result) == j);
940 CHECK(json::from_cbor(result) == v);
945 const json j = v;
950 const auto result = json::to_cbor(j);
953 CHECK(json::from_cbor(result) == j);
954 CHECK(json::from_cbor(result) == v);
959 const json j = v;
964 const auto result = json::to_cbor(j);
967 CHECK(json::from_cbor(result) == j);
968 CHECK(json::from_cbor(result) == v);
973 const json j = v;
979 const auto result = json::to_cbor(j);
982 CHECK(json::from_cbor(result) == j);
983 CHECK(json::from_cbor(result) == v);
988 const json j = v;
994 const auto result = json::to_cbor(j);
997 CHECK(json::from_cbor(result) == j);
998 CHECK(json::from_cbor(result) == v);
1009 json _;
1010json::from_cbor(std::vector<uint8_t>({0xf9})), "[json.exception.parse_error.110] parse error at by…
1011 … CHECK(json::from_cbor(std::vector<uint8_t>({0xf9}), true, false).is_discarded());
1015 json _;
1016json::from_cbor(std::vector<uint8_t>({0xf9, 0x7c})), "[json.exception.parse_error.110] parse error…
1017 … CHECK(json::from_cbor(std::vector<uint8_t>({0xf9, 0x7c}), true, false).is_discarded());
1025 json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x00, 0x00}));
1026 json::number_float_t d{j};
1032 json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x80, 0x00}));
1033 json::number_float_t d{j};
1039 json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x00, 0x01}));
1040 json::number_float_t d{j};
1049 json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x7c, 0x00}));
1050 json::number_float_t d{j};
1051 CHECK(d == std::numeric_limits<json::number_float_t>::infinity());
1057 json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0xfc, 0x00}));
1058 json::number_float_t d{j};
1059 CHECK(d == -std::numeric_limits<json::number_float_t>::infinity());
1068 json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x3c, 0x00}));
1069 json::number_float_t d{j};
1075 json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0xc0, 0x00}));
1076 json::number_float_t d{j};
1082 json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x7b, 0xff}));
1083 json::number_float_t d{j};
1090 json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x7c, 0x00}));
1091 json::number_float_t const d{j};
1098 json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x7e, 0x00}));
1099 json::number_float_t const d{j};
1114 // create JSON value with string containing of N * 'x'
1116 const json j = s;
1127 const auto result = json::to_cbor(j);
1137 CHECK(json::from_cbor(result) == j);
1138 CHECK(json::from_cbor(result, true, false) == j);
1148 // create JSON value with string containing of N * 'x'
1150 const json j = s;
1163 const auto result = json::to_cbor(j);
1170 CHECK(json::from_cbor(result) == j);
1171 CHECK(json::from_cbor(result, true, false) == j);
1184 // create JSON value with string containing of N * 'x'
1186 const json j = s;
1196 const auto result = json::to_cbor(j);
1203 CHECK(json::from_cbor(result) == j);
1204 CHECK(json::from_cbor(result, true, false) == j);
1217 // create JSON value with string containing of N * 'x'
1219 const json j = s;
1231 const auto result = json::to_cbor(j);
1238 CHECK(json::from_cbor(result) == j);
1239 CHECK(json::from_cbor(result, true, false) == j);
1248 const json j = json::array();
1250 const auto result = json::to_cbor(j);
1254 CHECK(json::from_cbor(result) == j);
1255 CHECK(json::from_cbor(result, true, false) == j);
1260 const json j = {nullptr};
1262 const auto result = json::to_cbor(j);
1266 CHECK(json::from_cbor(result) == j);
1267 CHECK(json::from_cbor(result, true, false) == j);
1272 const json j = json::parse("[1,2,3,4,5]");
1274 const auto result = json::to_cbor(j);
1278 CHECK(json::from_cbor(result) == j);
1279 CHECK(json::from_cbor(result, true, false) == j);
1284 const json j = json::parse("[[[[]]]]");
1286 const auto result = json::to_cbor(j);
1290 CHECK(json::from_cbor(result) == j);
1291 CHECK(json::from_cbor(result, true, false) == j);
1296 const json j(257, nullptr);
1301 const auto result = json::to_cbor(j);
1305 CHECK(json::from_cbor(result) == j);
1306 CHECK(json::from_cbor(result, true, false) == j);
1311 const json j(65793, nullptr);
1318 const auto result = json::to_cbor(j);
1322 CHECK(json::from_cbor(result) == j);
1323 CHECK(json::from_cbor(result, true, false) == j);
1331 const json j = json::object();
1333 const auto result = json::to_cbor(j);
1337 CHECK(json::from_cbor(result) == j);
1338 CHECK(json::from_cbor(result, true, false) == j);
1343 const json j = {{"", nullptr}};
1345 const auto result = json::to_cbor(j);
1349 CHECK(json::from_cbor(result) == j);
1350 CHECK(json::from_cbor(result, true, false) == j);
1355 const json j = json::parse(R"({"a": {"b": {"c": {}}}})");
1360 const auto result = json::to_cbor(j);
1364 CHECK(json::from_cbor(result) == j);
1365 CHECK(json::from_cbor(result, true, false) == j);
1370 json j;
1380 const auto result = json::to_cbor(j);
1391 CHECK(json::from_cbor(result) == j);
1392 CHECK(json::from_cbor(result, true, false) == j);
1397 json j;
1407 const auto result = json::to_cbor(j);
1420 CHECK(json::from_cbor(result) == j);
1421 CHECK(json::from_cbor(result, true, false) == j);
1426 json j;
1436 const auto result = json::to_cbor(j);
1451 CHECK(json::from_cbor(result) == j);
1452 CHECK(json::from_cbor(result, true, false) == j);
1464 // create JSON value with byte array containing of N * 'x'
1466 const json j = json::binary(s);
1477 const auto result = json::to_cbor(j);
1487 CHECK(json::from_cbor(result) == j);
1488 CHECK(json::from_cbor(result, true, false) == j);
1498 // create JSON value with string containing of N * 'x'
1500 const json j = json::binary(s);
1512 const auto result = json::to_cbor(j);
1519 CHECK(json::from_cbor(result) == j);
1520 CHECK(json::from_cbor(result, true, false) == j);
1533 // create JSON value with string containing of N * 'x'
1535 const json j = json::binary(s);
1545 const auto result = json::to_cbor(j);
1552 CHECK(json::from_cbor(result) == j);
1553 CHECK(json::from_cbor(result, true, false) == j);
1566 // create JSON value with string containing of N * 'x'
1568 const json j = json::binary(s);
1580 const auto result = json::to_cbor(j);
1587 CHECK(json::from_cbor(result) == j);
1588 CHECK(json::from_cbor(result, true, false) == j);
1595 auto j = json::from_cbor(input);
1597 auto k = json::binary({0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x99});
1598 CAPTURE(j.dump(0, ' ', false, json::error_handler_t::strict))
1606 json _;
1607 CHECK_NOTHROW(_ = json::from_cbor(input));
1614 json _;
1615 CHECK_NOTHROW(_ = json::from_cbor(input));
1625 …auto callback = [&binary_seen](int /*depth*/, json::parse_event_t /*event*/, json & parsed) noexce…
1634 json j;
1635 auto cbp = nlohmann::detail::json_sax_dom_callback_parser<json>(j, callback, true);
1636 CHECK(json::sax_parse(input, &cbp, json::input_format_t::cbor));
1650 const json j = json::from_cbor(given);
1651 CHECK(j == json::binary(std::vector<uint8_t> {'a'}));
1659 const json j = json::from_cbor(given);
1668 const json j = json::from_cbor(given);
1669 CHECK(j == json::parse("[false]"));
1677 const json j = json::from_cbor(given);
1678 CHECK(j == json::parse("{\"\": false}"));
1686 json _;
1687json::from_cbor(std::vector<uint8_t>()), "[json.exception.parse_error.110] parse error at byte 1: …
1688 CHECK(json::from_cbor(std::vector<uint8_t>(), true, false).is_discarded());
1693 json _;
1694json::from_cbor(std::vector<uint8_t>({0x18})), "[json.exception.parse_error.110] parse error at by…
1695json::from_cbor(std::vector<uint8_t>({0x19})), "[json.exception.parse_error.110] parse error at by…
1696json::from_cbor(std::vector<uint8_t>({0x19, 0x00})), "[json.exception.parse_error.110] parse error…
1697json::from_cbor(std::vector<uint8_t>({0x1a})), "[json.exception.parse_error.110] parse error at by…
1698json::from_cbor(std::vector<uint8_t>({0x1a, 0x00})), "[json.exception.parse_error.110] parse error…
1699json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x00})), "[json.exception.parse_error.110] parse…
1700json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x00, 0x00})), "[json.exception.parse_error.110]…
1701json::from_cbor(std::vector<uint8_t>({0x1b})), "[json.exception.parse_error.110] parse error at by…
1702json::from_cbor(std::vector<uint8_t>({0x1b, 0x00})), "[json.exception.parse_error.110] parse error…
1703json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00})), "[json.exception.parse_error.110] parse…
1704json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00})), "[json.exception.parse_error.110]…
1705json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00})), "[json.exception.parse_erro…
1706json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00})), "[json.exception.pars…
1707json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})), "[json.exceptio…
1708json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})), "[json.ex…
1709json::from_cbor(std::vector<uint8_t>({0x62})), "[json.exception.parse_error.110] parse error at by…
1710json::from_cbor(std::vector<uint8_t>({0x62, 0x60})), "[json.exception.parse_error.110] parse error…
1711json::from_cbor(std::vector<uint8_t>({0x7F})), "[json.exception.parse_error.110] parse error at by…
1712json::from_cbor(std::vector<uint8_t>({0x7F, 0x60})), "[json.exception.parse_error.110] parse error…
1713json::from_cbor(std::vector<uint8_t>({0x82, 0x01})), "[json.exception.parse_error.110] parse error…
1714json::from_cbor(std::vector<uint8_t>({0x9F, 0x01})), "[json.exception.parse_error.110] parse error…
1715json::from_cbor(std::vector<uint8_t>({0xBF, 0x61, 0x61, 0xF5})), "[json.exception.parse_error.110]…
1716json::from_cbor(std::vector<uint8_t>({0xA1, 0x61, 0X61})), "[json.exception.parse_error.110] parse…
1717json::from_cbor(std::vector<uint8_t>({0xBF, 0x61, 0X61})), "[json.exception.parse_error.110] parse…
1718json::from_cbor(std::vector<uint8_t>({0x5F})), "[json.exception.parse_error.110] parse error at by…
1719json::from_cbor(std::vector<uint8_t>({0x5F, 0x00})), "[json.exception.parse_error.113] parse error…
1720json::from_cbor(std::vector<uint8_t>({0x41})), "[json.exception.parse_error.110] parse error at by…
1722 CHECK(json::from_cbor(std::vector<uint8_t>({0x18}), true, false).is_discarded());
1723 CHECK(json::from_cbor(std::vector<uint8_t>({0x19}), true, false).is_discarded());
1724 CHECK(json::from_cbor(std::vector<uint8_t>({0x19, 0x00}), true, false).is_discarded());
1725 CHECK(json::from_cbor(std::vector<uint8_t>({0x1a}), true, false).is_discarded());
1726 CHECK(json::from_cbor(std::vector<uint8_t>({0x1a, 0x00}), true, false).is_discarded());
1727 … CHECK(json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x00}), true, false).is_discarded());
1728 …CHECK(json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x00, 0x00}), true, false).is_discarded());
1729 CHECK(json::from_cbor(std::vector<uint8_t>({0x1b}), true, false).is_discarded());
1730 CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00}), true, false).is_discarded());
1731 … CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00}), true, false).is_discarded());
1732 …CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00}), true, false).is_discarded());
1733 …CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00}), true, false).is_discar…
1734 …CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00}), true, false).is_…
1735 …CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}), true, fals…
1736 …CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}), true…
1737 CHECK(json::from_cbor(std::vector<uint8_t>({0x62}), true, false).is_discarded());
1738 CHECK(json::from_cbor(std::vector<uint8_t>({0x62, 0x60}), true, false).is_discarded());
1739 CHECK(json::from_cbor(std::vector<uint8_t>({0x7F}), true, false).is_discarded());
1740 CHECK(json::from_cbor(std::vector<uint8_t>({0x7F, 0x60}), true, false).is_discarded());
1741 CHECK(json::from_cbor(std::vector<uint8_t>({0x82, 0x01}), true, false).is_discarded());
1742 CHECK(json::from_cbor(std::vector<uint8_t>({0x9F, 0x01}), true, false).is_discarded());
1743 …CHECK(json::from_cbor(std::vector<uint8_t>({0xBF, 0x61, 0x61, 0xF5}), true, false).is_discarded());
1744 … CHECK(json::from_cbor(std::vector<uint8_t>({0xA1, 0x61, 0x61}), true, false).is_discarded());
1745 … CHECK(json::from_cbor(std::vector<uint8_t>({0xBF, 0x61, 0x61}), true, false).is_discarded());
1746 CHECK(json::from_cbor(std::vector<uint8_t>({0x5F}), true, false).is_discarded());
1747 CHECK(json::from_cbor(std::vector<uint8_t>({0x5F, 0x00}), true, false).is_discarded());
1748 CHECK(json::from_cbor(std::vector<uint8_t>({0x41}), true, false).is_discarded());
1755 json _;
1756json::from_cbor(std::vector<uint8_t>({0x1c})), "[json.exception.parse_error.112] parse error at by…
1757 CHECK(json::from_cbor(std::vector<uint8_t>({0x1c}), true, false).is_discarded());
1759json::from_cbor(std::vector<uint8_t>({0xf8})), "[json.exception.parse_error.112] parse error at by…
1760 CHECK(json::from_cbor(std::vector<uint8_t>({0xf8}), true, false).is_discarded());
1803 json _;
1804 …CHECK_THROWS_AS(_ = json::from_cbor(std::vector<uint8_t>({static_cast<uint8_t>(byte)})), json::par…
1805 …CHECK(json::from_cbor(std::vector<uint8_t>({static_cast<uint8_t>(byte)}), true, false).is_discarde…
1812 json _;
1813json::from_cbor(std::vector<uint8_t>({0xa1, 0xff, 0x01})), "[json.exception.parse_error.113] parse…
1814 … CHECK(json::from_cbor(std::vector<uint8_t>({0xa1, 0xff, 0x01}), true, false).is_discarded());
1822 const auto result = json::from_cbor(vec, false);
1823 CHECK(result == json());
1824 CHECK(!json::from_cbor(vec, false, false).is_discarded());
1829 json _;
1830json::from_cbor(vec), "[json.exception.parse_error.110] parse error at byte 2: syntax error while …
1831 CHECK(json::from_cbor(vec, true, false).is_discarded());
1842 CHECK(!json::sax_parse(v, &scp, json::input_format_t::cbor));
1849 CHECK(!json::sax_parse(v, &scp, json::input_format_t::cbor));
1856 CHECK(!json::sax_parse(v, &scp, json::input_format_t::cbor));
1864 SECTION("sample.json")
1866 std::string const filename = TEST_DATA_DIRECTORY "/json_testsuite/sample.json";
1868 // parse JSON file
1870 const json j1 = json::parse(f_json);
1874 json j2;
1875 CHECK_NOTHROW(j2 = json::from_cbor(packed));
1877 // compare parsed JSON values
1885 json::to_cbor(j1, ss);
1886 json j3 = json::from_cbor(ss.str());
1893 json::to_cbor(j1, s);
1894 json j3 = json::from_cbor(s);
1901 CHECK(j1 == json::from_cbor(packed.begin() + 5, packed.end()));
1946 json j1 = json::from_cbor(vec1); in CAPTURE()
1951 std::vector<uint8_t> const vec2 = json::to_cbor(j1); in CAPTURE()
1954 json j2 = json::from_cbor(vec2); in CAPTURE()
1959 catch (const json::parse_error&) in CAPTURE()
1965 catch (const json::parse_error&) // NOLINT(bugprone-empty-catch)
1980 exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/1.json"); in skip()
1981 exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/2.json"); in skip()
1982 exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/3.json"); in skip()
1983 exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/4.json"); in skip()
1984 exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/5.json"); in skip()
1985 exclude_packed.insert(TEST_DATA_DIRECTORY "/json_testsuite/sample.json"); // kills AppVeyor in skip()
1986 exclude_packed.insert(TEST_DATA_DIRECTORY "/json_tests/pass1.json"); in skip()
1987 exclude_packed.insert(TEST_DATA_DIRECTORY "/regression/working_file.json"); in skip()
1988 exclude_packed.insert(TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object.json"); in skip()
1989 …packed.insert(TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_duplicated_key.json"); in skip()
1990 …e_packed.insert(TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_long_strings.json"); in skip()
1994 TEST_DATA_DIRECTORY "/json_nlohmann_tests/all_unicode.json", in skip()
1995 TEST_DATA_DIRECTORY "/json.org/1.json", in skip()
1996 TEST_DATA_DIRECTORY "/json.org/2.json", in skip()
1997 TEST_DATA_DIRECTORY "/json.org/3.json", in skip()
1998 TEST_DATA_DIRECTORY "/json.org/4.json", in skip()
1999 TEST_DATA_DIRECTORY "/json.org/5.json", in skip()
2000 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip01.json", in skip()
2001 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip02.json", in skip()
2002 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip03.json", in skip()
2003 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip04.json", in skip()
2004 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip05.json", in skip()
2005 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip06.json", in skip()
2006 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip07.json", in skip()
2007 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip08.json", in skip()
2008 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip09.json", in skip()
2009 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip10.json", in skip()
2010 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip11.json", in skip()
2011 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip12.json", in skip()
2012 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip13.json", in skip()
2013 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip14.json", in skip()
2014 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip15.json", in skip()
2015 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip16.json", in skip()
2016 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip17.json", in skip()
2017 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip18.json", in skip()
2018 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip19.json", in skip()
2019 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip20.json", in skip()
2020 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip21.json", in skip()
2021 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip22.json", in skip()
2022 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip23.json", in skip()
2023 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip24.json", in skip()
2024 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip25.json", in skip()
2025 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip26.json", in skip()
2026 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip27.json", in skip()
2027 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip28.json", in skip()
2028 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip29.json", in skip()
2029 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip30.json", in skip()
2030 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip31.json", in skip()
2031 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip32.json", in skip()
2032 TEST_DATA_DIRECTORY "/json_testsuite/sample.json", // kills AppVeyor in skip()
2033 TEST_DATA_DIRECTORY "/json_tests/pass1.json", in skip()
2034 TEST_DATA_DIRECTORY "/json_tests/pass2.json", in skip()
2035 TEST_DATA_DIRECTORY "/json_tests/pass3.json", in skip()
2036 TEST_DATA_DIRECTORY "/regression/floats.json", in skip()
2037 TEST_DATA_DIRECTORY "/regression/signed_ints.json", in skip()
2038 TEST_DATA_DIRECTORY "/regression/unsigned_ints.json", in skip()
2039 TEST_DATA_DIRECTORY "/regression/working_file.json", in skip()
2040 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_arraysWithSpaces.json", in skip()
2041 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_empty-string.json", in skip()
2042 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_empty.json", in skip()
2043 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_ending_with_newline.json", in skip()
2044 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_false.json", in skip()
2045 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_heterogeneous.json", in skip()
2046 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_null.json", in skip()
2047 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_with_1_and_newline.json", in skip()
2048 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_with_leading_space.json", in skip()
2049 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_with_several_null.json", in skip()
2050 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_with_trailing_space.json", in skip()
2051 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number.json", in skip()
2052 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_0e+1.json", in skip()
2053 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_0e1.json", in skip()
2054 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_after_space.json", in skip()
2055 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_double_close_to_zero.json", in skip()
2056 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_double_huge_neg_exp.json", in skip()
2057 //TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_huge_exp.json", in skip()
2058 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_int_with_exp.json", in skip()
2059 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_minus_zero.json", in skip()
2060 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_negative_int.json", in skip()
2061 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_negative_one.json", in skip()
2062 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_negative_zero.json", in skip()
2063 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_capital_e.json", in skip()
2064 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_capital_e_neg_exp.json", in skip()
2065 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_capital_e_pos_exp.json", in skip()
2066 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_exponent.json", in skip()
2067 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_fraction_exponent.json", in skip()
2068 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_neg_exp.json", in skip()
2069 … //TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_neg_overflow.json", in skip()
2070 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_pos_exponent.json", in skip()
2071 … //TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_pos_overflow.json", in skip()
2072 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_underflow.json", in skip()
2073 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_simple_int.json", in skip()
2074 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_simple_real.json", in skip()
2075 … //TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_too_big_neg_int.json", in skip()
2076 … //TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_too_big_pos_int.json", in skip()
2077 … //TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_very_big_negative_int.json", in skip()
2078 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object.json", in skip()
2079 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_basic.json", in skip()
2080 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_duplicated_key.json", in skip()
2081 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_duplicated_key_and_value.json", in skip()
2082 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_empty.json", in skip()
2083 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_empty_key.json", in skip()
2084 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_escaped_null_in_key.json", in skip()
2085 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_extreme_numbers.json", in skip()
2086 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_long_strings.json", in skip()
2087 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_simple.json", in skip()
2088 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_string_unicode.json", in skip()
2089 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_with_newlines.json", in skip()
2090 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_1_2_3_bytes_UTF-8_sequences.json", in skip()
2091 …Y "/nst_json_testsuite/test_parsing/y_string_UTF-16_Surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json", in skip()
2092 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_accepted_surrogate_pair.json", in skip()
2093 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_accepted_surrogate_pairs.json", in skip()
2094 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_allowed_escapes.json", in skip()
2095 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_backslash_and_u_escaped_zero.json", in skip()
2096 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_backslash_doublequotes.json", in skip()
2097 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_comments.json", in skip()
2098 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_double_escape_a.json", in skip()
2099 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_double_escape_n.json", in skip()
2100 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_escaped_control_character.json", in skip()
2101 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_escaped_noncharacter.json", in skip()
2102 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_in_array.json", in skip()
2103 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_in_array_with_leading_space.json", in skip()
2104 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_last_surrogates_1_and_2.json", in skip()
2105 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_newline_uescaped.json", in skip()
2106 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_nonCharacterInUTF-8_U+10FFFF.json", in skip()
2107 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_nonCharacterInUTF-8_U+1FFFF.json", in skip()
2108 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_nonCharacterInUTF-8_U+FFFF.json", in skip()
2109 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_null_escape.json", in skip()
2110 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_one-byte-utf-8.json", in skip()
2111 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_pi.json", in skip()
2112 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_simple_ascii.json", in skip()
2113 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_space.json", in skip()
2114 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_three-byte-utf-8.json", in skip()
2115 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_two-byte-utf-8.json", in skip()
2116 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_u+2028_line_sep.json", in skip()
2117 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_u+2029_par_sep.json", in skip()
2118 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_uEscape.json", in skip()
2119 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unescaped_char_delete.json", in skip()
2120 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unicode.json", in skip()
2121 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unicodeEscapedBackslash.json", in skip()
2122 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unicode_2.json", in skip()
2123 …ST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json", in skip()
2124 …TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unicode_U+2064_invisible_plus.json", in skip()
2125 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unicode_escaped_double_quote.json", in skip()
2126 // TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_utf16.json", in skip()
2127 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_utf8.json", in skip()
2128 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_with_del_character.json", in skip()
2129 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_lonely_false.json", in skip()
2130 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_lonely_int.json", in skip()
2131 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_lonely_negative_real.json", in skip()
2132 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_lonely_null.json", in skip()
2133 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_lonely_string.json", in skip()
2134 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_lonely_true.json", in skip()
2135 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_string_empty.json", in skip()
2136 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_trailing_newline.json", in skip()
2137 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_true_in_array.json", in skip()
2138 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_whitespace_array.json" in skip()
2145 // parse JSON file in skip()
2147 json j1 = json::parse(f_json); in skip()
2151 json j2; in skip()
2152 CHECK_NOTHROW(j2 = json::from_cbor(packed)); in skip()
2154 // compare parsed JSON values in skip()
2160 // parse JSON file in skip()
2162 json j1 = json::parse(f_json); in skip()
2166 json j2; in skip()
2167 CHECK_NOTHROW(j2 = json::from_cbor(f_cbor)); in skip()
2169 // compare parsed JSON values in skip()
2175 // parse JSON file in skip()
2177 json j1 = json::parse(f_json); in skip()
2181 json j2; in skip()
2182 CHECK_NOTHROW(j2 = json::from_cbor({packed.data(), packed.size()})); in skip()
2184 // compare parsed JSON values in skip()
2190 // parse JSON file in skip()
2192 json const j1 = json::parse(f_json); in skip()
2202 json::to_cbor(j1, vec); in skip()
2264 auto res = json::from_cbor(std::vector<uint8_t>(1, byte));
2266 catch (const json::parse_error& e)
2288 CHECK(json::to_cbor(json::parse("0")) == std::vector<uint8_t>({0x00}));
2289 CHECK(json::parse("0") == json::from_cbor(std::vector<uint8_t>({0x00})));
2291 CHECK(json::to_cbor(json::parse("1")) == std::vector<uint8_t>({0x01}));
2292 CHECK(json::parse("1") == json::from_cbor(std::vector<uint8_t>({0x01})));
2294 CHECK(json::to_cbor(json::parse("10")) == std::vector<uint8_t>({0x0a}));
2295 CHECK(json::parse("10") == json::from_cbor(std::vector<uint8_t>({0x0a})));
2297 CHECK(json::to_cbor(json::parse("23")) == std::vector<uint8_t>({0x17}));
2298 CHECK(json::parse("23") == json::from_cbor(std::vector<uint8_t>({0x17})));
2300 CHECK(json::to_cbor(json::parse("24")) == std::vector<uint8_t>({0x18, 0x18}));
2301 CHECK(json::parse("24") == json::from_cbor(std::vector<uint8_t>({0x18, 0x18})));
2303 CHECK(json::to_cbor(json::parse("25")) == std::vector<uint8_t>({0x18, 0x19}));
2304 CHECK(json::parse("25") == json::from_cbor(std::vector<uint8_t>({0x18, 0x19})));
2306 CHECK(json::to_cbor(json::parse("100")) == std::vector<uint8_t>({0x18, 0x64}));
2307 CHECK(json::parse("100") == json::from_cbor(std::vector<uint8_t>({0x18, 0x64})));
2309 CHECK(json::to_cbor(json::parse("1000")) == std::vector<uint8_t>({0x19, 0x03, 0xe8}));
2310 CHECK(json::parse("1000") == json::from_cbor(std::vector<uint8_t>({0x19, 0x03, 0xe8})));
2312 …CHECK(json::to_cbor(json::parse("1000000")) == std::vector<uint8_t>({0x1a, 0x00, 0x0f, 0x42, 0x40}…
2313 …CHECK(json::parse("1000000") == json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x0f, 0x42, 0x40…
2315 …CHECK(json::to_cbor(json::parse("1000000000000")) == std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00,…
2316 …CHECK(json::parse("1000000000000") == json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00…
2318 …CHECK(json::to_cbor(json::parse("18446744073709551615")) == std::vector<uint8_t>({0x1b, 0xff, 0xff…
2319 …CHECK(json::parse("18446744073709551615") == json::from_cbor(std::vector<uint8_t>({0x1b, 0xff, 0xf…
2322 …//CHECK(json::to_cbor(json::parse("18446744073709551616")) == std::vector<uint8_t>({0xc2, 0x49, 0x…
2323 …//CHECK(json::parse("18446744073709551616") == json::from_cbor(std::vector<uint8_t>({0xc2, 0x49, 0…
2325 …//CHECK(json::to_cbor(json::parse("-18446744073709551616")) == std::vector<uint8_t>({0x3b, 0xff, 0…
2326 …//CHECK(json::parse("-18446744073709551616") == json::from_cbor(std::vector<uint8_t>({0x3b, 0xff, …
2329 …//CHECK(json::to_cbor(json::parse("-18446744073709551617")) == std::vector<uint8_t>({0xc3, 0x49, 0…
2330 …//CHECK(json::parse("-18446744073709551617") == json::from_cbor(std::vector<uint8_t>({0xc3, 0x49, …
2332 CHECK(json::to_cbor(json::parse("-1")) == std::vector<uint8_t>({0x20}));
2333 CHECK(json::parse("-1") == json::from_cbor(std::vector<uint8_t>({0x20})));
2335 CHECK(json::to_cbor(json::parse("-10")) == std::vector<uint8_t>({0x29}));
2336 CHECK(json::parse("-10") == json::from_cbor(std::vector<uint8_t>({0x29})));
2338 CHECK(json::to_cbor(json::parse("-100")) == std::vector<uint8_t>({0x38, 0x63}));
2339 CHECK(json::parse("-100") == json::from_cbor(std::vector<uint8_t>({0x38, 0x63})));
2341 CHECK(json::to_cbor(json::parse("-1000")) == std::vector<uint8_t>({0x39, 0x03, 0xe7}));
2342 CHECK(json::parse("-1000") == json::from_cbor(std::vector<uint8_t>({0x39, 0x03, 0xe7})));
2345 //CHECK(json::to_cbor(json::parse("0.0")) == std::vector<uint8_t>({0xf9, 0x00, 0x00}));
2346 CHECK(json::parse("0.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0x00, 0x00})));
2349 //CHECK(json::to_cbor(json::parse("-0.0")) == std::vector<uint8_t>({0xf9, 0x80, 0x00}));
2350 CHECK(json::parse("-0.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0x80, 0x00})));
2353 //CHECK(json::to_cbor(json::parse("1.0")) == std::vector<uint8_t>({0xf9, 0x3c, 0x00}));
2354 CHECK(json::parse("1.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0x3c, 0x00})));
2356 …CHECK(json::to_cbor(json::parse("1.1")) == std::vector<uint8_t>({0xfb, 0x3f, 0xf1, 0x99, 0x99, 0x9…
2357 …CHECK(json::parse("1.1") == json::from_cbor(std::vector<uint8_t>({0xfb, 0x3f, 0xf1, 0x99, 0x99, 0x…
2360 //CHECK(json::to_cbor(json::parse("1.5")) == std::vector<uint8_t>({0xf9, 0x3e, 0x00}));
2361 CHECK(json::parse("1.5") == json::from_cbor(std::vector<uint8_t>({0xf9, 0x3e, 0x00})));
2364 //CHECK(json::to_cbor(json::parse("65504.0")) == std::vector<uint8_t>({0xf9, 0x7b, 0xff}));
2365 CHECK(json::parse("65504.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0x7b, 0xff})));
2367 …//CHECK(json::to_cbor(json::parse("100000.0")) == std::vector<uint8_t>({0xfa, 0x47, 0xc3, 0x50, 0x…
2368 …CHECK(json::parse("100000.0") == json::from_cbor(std::vector<uint8_t>({0xfa, 0x47, 0xc3, 0x50, 0x0…
2370 …//CHECK(json::to_cbor(json::parse("3.4028234663852886e+38")) == std::vector<uint8_t>({0xfa, 0x7f, …
2371 …CHECK(json::parse("3.4028234663852886e+38") == json::from_cbor(std::vector<uint8_t>({0xfa, 0x7f, 0…
2373 …CHECK(json::to_cbor(json::parse("1.0e+300")) == std::vector<uint8_t>({0xfb, 0x7e, 0x37, 0xe4, 0x3c…
2374 …CHECK(json::parse("1.0e+300") == json::from_cbor(std::vector<uint8_t>({0xfb, 0x7e, 0x37, 0xe4, 0x3…
2377 …//CHECK(json::to_cbor(json::parse("5.960464477539063e-8")) == std::vector<uint8_t>({0xf9, 0x00, 0x…
2378 CHECK(json::parse("-4.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0xc4, 0x00})));
2381 …//CHECK(json::to_cbor(json::parse("0.00006103515625")) == std::vector<uint8_t>({0xf9, 0x04, 0x00})…
2382 CHECK(json::parse("-4.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0xc4, 0x00})));
2385 //CHECK(json::to_cbor(json::parse("-4.0")) == std::vector<uint8_t>({0xf9, 0xc4, 0x00}));
2386 CHECK(json::parse("-4.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0xc4, 0x00})));
2388 …CHECK(json::to_cbor(json::parse("-4.1")) == std::vector<uint8_t>({0xfb, 0xc0, 0x10, 0x66, 0x66, 0x…
2389 …CHECK(json::parse("-4.1") == json::from_cbor(std::vector<uint8_t>({0xfb, 0xc0, 0x10, 0x66, 0x66, 0…
2394 CHECK(json::to_cbor(json::parse("false")) == std::vector<uint8_t>({0xf4}));
2395 CHECK(json::parse("false") == json::from_cbor(std::vector<uint8_t>({0xf4})));
2397 CHECK(json::to_cbor(json::parse("true")) == std::vector<uint8_t>({0xf5}));
2398 CHECK(json::parse("true") == json::from_cbor(std::vector<uint8_t>({0xf5})));
2400 CHECK(json::to_cbor(json::parse("true")) == std::vector<uint8_t>({0xf5}));
2401 CHECK(json::parse("true") == json::from_cbor(std::vector<uint8_t>({0xf5})));
2406 CHECK(json::to_cbor(json::parse("\"\"")) == std::vector<uint8_t>({0x60}));
2407 CHECK(json::parse("\"\"") == json::from_cbor(std::vector<uint8_t>({0x60})));
2409 CHECK(json::to_cbor(json::parse("\"a\"")) == std::vector<uint8_t>({0x61, 0x61}));
2410 CHECK(json::parse("\"a\"") == json::from_cbor(std::vector<uint8_t>({0x61, 0x61})));
2412 …CHECK(json::to_cbor(json::parse("\"IETF\"")) == std::vector<uint8_t>({0x64, 0x49, 0x45, 0x54, 0x46…
2413 …CHECK(json::parse("\"IETF\"") == json::from_cbor(std::vector<uint8_t>({0x64, 0x49, 0x45, 0x54, 0x4…
2415 … CHECK(json::to_cbor(json::parse("\"\\u00fc\"")) == std::vector<uint8_t>({0x62, 0xc3, 0xbc}));
2416 … CHECK(json::parse("\"\\u00fc\"") == json::from_cbor(std::vector<uint8_t>({0x62, 0xc3, 0xbc})));
2418 …CHECK(json::to_cbor(json::parse("\"\\u6c34\"")) == std::vector<uint8_t>({0x63, 0xe6, 0xb0, 0xb4}));
2419 …CHECK(json::parse("\"\\u6c34\"") == json::from_cbor(std::vector<uint8_t>({0x63, 0xe6, 0xb0, 0xb4})…
2421 …CHECK(json::to_cbor(json::parse("\"\\ud800\\udd51\"")) == std::vector<uint8_t>({0x64, 0xf0, 0x90, …
2422 …CHECK(json::parse("\"\\ud800\\udd51\"") == json::from_cbor(std::vector<uint8_t>({0x64, 0xf0, 0x90,…
2425 …CHECK(json::parse("\"streaming\"") == json::from_cbor(std::vector<uint8_t>({0x7f, 0x65, 0x73, 0x74…
2431 json j;
2432 CHECK_NOTHROW(j = json::from_cbor(packed));
2435 CHECK(j == json::binary(expected));
2438 …CHECK(json::to_cbor(json::binary(std::vector<uint8_t> {}, 0x42)) == std::vector<uint8_t> {0xd8, 0x…
2439 …CHECK(!json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 0x42)), true, true, jso…
2440 …CHECK(json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 0x42)), true, true, json
2442 …CHECK(json::to_cbor(json::binary(std::vector<uint8_t> {}, 1000)) == std::vector<uint8_t> {0xd9, 0x…
2443 …CHECK(!json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 1000)), true, true, jso…
2444 …CHECK(json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 1000)), true, true, json
2446 …CHECK(json::to_cbor(json::binary(std::vector<uint8_t> {}, 394216)) == std::vector<uint8_t> {0xda, …
2447 …CHECK(!json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 394216)), true, true, j…
2448 …CHECK(json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 394216)), true, true, js…
2450 …CHECK(json::to_cbor(json::binary(std::vector<uint8_t> {}, 8589934590)) == std::vector<uint8_t> {0x…
2451 …CHECK(!json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 8589934590)), true, tru…
2452 …CHECK(json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 8589934590)), true, true…
2457 CHECK(json::to_cbor(json::parse("[]")) == std::vector<uint8_t>({0x80}));
2458 CHECK(json::parse("[]") == json::from_cbor(std::vector<uint8_t>({0x80})));
2460 … CHECK(json::to_cbor(json::parse("[1, 2, 3]")) == std::vector<uint8_t>({0x83, 0x01, 0x02, 0x03}));
2461 …CHECK(json::parse("[1, 2, 3]") == json::from_cbor(std::vector<uint8_t>({0x83, 0x01, 0x02, 0x03})));
2463 …CHECK(json::to_cbor(json::parse("[1, [2, 3], [4, 5]]")) == std::vector<uint8_t>({0x83, 0x01, 0x82,…
2464 …CHECK(json::parse("[1, [2, 3], [4, 5]]") == json::from_cbor(std::vector<uint8_t>({0x83, 0x01, 0x82…
2466 …CHECK(json::to_cbor(json::parse("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 1…
2467 …CHECK(json::parse("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,…
2470 CHECK(json::parse("[]") == json::from_cbor(std::vector<uint8_t>({0x9f, 0xff})));
2471 …CHECK(json::parse("[1, [2, 3], [4, 5]] ") == json::from_cbor(std::vector<uint8_t>({0x9f, 0x01, 0x8…
2472 …CHECK(json::parse("[1, [2, 3], [4, 5]]") == json::from_cbor(std::vector<uint8_t>({0x9f, 0x01, 0x82…
2473 …CHECK(json::parse("[1, [2, 3], [4, 5]]") == json::from_cbor(std::vector<uint8_t>({0x83, 0x01, 0x82…
2474 …CHECK(json::parse("[1, [2, 3], [4, 5]]") == json::from_cbor(std::vector<uint8_t>({0x83, 0x01, 0x9f…
2475 …CHECK(json::parse("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,…
2480 CHECK(json::to_cbor(json::parse("{}")) == std::vector<uint8_t>({0xa0}));
2481 CHECK(json::parse("{}") == json::from_cbor(std::vector<uint8_t>({0xa0})));
2483 …CHECK(json::to_cbor(json::parse("{\"a\": 1, \"b\": [2, 3]}")) == std::vector<uint8_t>({0xa2, 0x61,…
2484 …CHECK(json::parse("{\"a\": 1, \"b\": [2, 3]}") == json::from_cbor(std::vector<uint8_t>({0xa2, 0x61…
2486 …CHECK(json::to_cbor(json::parse("[\"a\", {\"b\": \"c\"}]")) == std::vector<uint8_t>({0x82, 0x61, 0…
2487 …CHECK(json::parse("[\"a\", {\"b\": \"c\"}]") == json::from_cbor(std::vector<uint8_t>({0x82, 0x61, …
2489 …CHECK(json::to_cbor(json::parse("{\"a\": \"A\", \"b\": \"B\", \"c\": \"C\", \"d\": \"D\", \"e\": \…
2490 …CHECK(json::parse("{\"a\": \"A\", \"b\": \"B\", \"c\": \"C\", \"d\": \"D\", \"e\": \"E\"}") == jso…
2493 …CHECK(json::parse("{\"a\": 1, \"b\": [2, 3]}") == json::from_cbor(std::vector<uint8_t>({0xbf, 0x61…
2494 …CHECK(json::parse("[\"a\", {\"b\": \"c\"}]") == json::from_cbor(std::vector<uint8_t>({0x82, 0x61, …
2495 …CHECK(json::parse("{\"Fun\": true, \"Amt\": -2}") == json::from_cbor(std::vector<uint8_t>({0xbf, 0…
2501 const json j = "s";
2502 auto v = json::to_cbor(j);
2518 json _;
2519 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2520 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2523 auto j_tagged = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore);
2526 … auto j_tagged_stored = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::store);
2541 json _;
2542 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2543 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2546 auto j_tagged = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore);
2557 json _;
2558 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2559 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2560 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore), json:…
2575 json _;
2576 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2577 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2580 auto j_tagged = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore);
2592 json _;
2593 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2594 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2595 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore), json:…
2612 json _;
2613 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2614 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2617 auto j_tagged = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore);
2631 json _;
2632 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2633 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2634 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore), json:…
2655 json _;
2656 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2657 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2660 auto j_tagged = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore);
2678 json _;
2679 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2680 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2681 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore), json:…
2688 json j_binary;
2689 j_binary["binary"] = json::binary({0xCA, 0xFE, 0xBA, 0xBE}, 42);
2692 const auto vec = json::to_cbor(j_binary);
2696 json _;
2697 …(_ = json::from_cbor(vec), "[json.exception.parse_error.112] parse error at byte 9: syntax error w…
2700 json jb = json::from_cbor(vec, true, true, json::cbor_tag_handler_t::ignore);