• 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;
40 bool number_integer(json::number_integer_t /*unused*/) in number_integer()
45 bool number_unsigned(json::number_unsigned_t /*unused*/) in number_unsigned()
50 bool number_float(json::number_float_t /*unused*/, const std::string& /*unused*/) in number_float()
90 …bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/, const json::exception& /*u… in parse_error()
107 json j = json::value_t::discarded;
108 const auto result = json::to_cbor(j);
115 json j = std::numeric_limits<json::number_float_t>::quiet_NaN();
117 const auto result = json::to_cbor(j);
124 json j = std::numeric_limits<json::number_float_t>::infinity();
126 const auto result = json::to_cbor(j);
132 json j = nullptr;
134 const auto result = json::to_cbor(j);
138 CHECK(json::from_cbor(result) == j);
139 CHECK(json::from_cbor(result, true, false) == j);
146 json j = true;
148 const auto result = json::to_cbor(j);
152 CHECK(json::from_cbor(result) == j);
153 CHECK(json::from_cbor(result, true, false) == j);
158 json j = false;
160 const auto result = json::to_cbor(j);
164 CHECK(json::from_cbor(result) == j);
165 CHECK(json::from_cbor(result, true, false) == j);
191 // create JSON value with integer number
192 json j = i;
211 const auto result = json::to_cbor(j);
229 CHECK(json::from_cbor(result) == j);
230 CHECK(json::from_cbor(result, true, false) == j);
248 // create JSON value with integer number
249 json j = i;
264 const auto result = json::to_cbor(j);
278 CHECK(json::from_cbor(result) == j);
279 CHECK(json::from_cbor(result, true, false) == j);
289 // create JSON value with integer number
290 json j = i;
303 const auto result = json::to_cbor(j);
314 CHECK(json::from_cbor(result) == j);
315 CHECK(json::from_cbor(result, true, false) == j);
321 json j = -9263;
324 const auto result = json::to_cbor(j);
331 CHECK(json::from_cbor(result) == j);
332 CHECK(json::from_cbor(result, true, false) == j);
341 // create JSON value with integer number
342 json j = i;
353 const auto result = json::to_cbor(j);
362 CHECK(json::from_cbor(result) == j);
363 CHECK(json::from_cbor(result, true, false) == j);
373 // create JSON value with integer number
374 json j = i;
384 const auto result = json::to_cbor(j);
392 CHECK(json::from_cbor(result) == j);
393 CHECK(json::from_cbor(result, true, false) == j);
403 // create JSON value with integer number
404 json j = -1;
405 … j.get_ref<json::number_integer_t&>() = static_cast<json::number_integer_t>(i);
415 const auto result = json::to_cbor(j);
423 CHECK(json::from_cbor(result) == j);
424 CHECK(json::from_cbor(result, true, false) == j);
434 // create JSON value with integer number
435 json j = -1;
436 … j.get_ref<json::number_integer_t&>() = static_cast<json::number_integer_t>(i);
447 const auto result = json::to_cbor(j);
456 CHECK(json::from_cbor(result) == j);
457 CHECK(json::from_cbor(result, true, false) == j);
467 // create JSON value with integer number
468 json j = -1;
469 … j.get_ref<json::number_integer_t&>() = static_cast<json::number_integer_t>(i);
481 const auto result = json::to_cbor(j);
491 CHECK(json::from_cbor(result) == j);
492 CHECK(json::from_cbor(result, true, false) == j);
505 // create JSON value with integer number
506 json j = -1;
507 … j.get_ref<json::number_integer_t&>() = static_cast<json::number_integer_t>(i);
521 const auto result = json::to_cbor(j);
534 CHECK(json::from_cbor(result) == j);
535 CHECK(json::from_cbor(result, true, false) == j);
548 // create JSON value with integer number
549 json j = -1;
550 … j.get_ref<json::number_integer_t&>() = static_cast<json::number_integer_t>(i);
568 const auto result = json::to_cbor(j);
585 CHECK(json::from_cbor(result) == j);
586 CHECK(json::from_cbor(result, true, false) == j);
596 // create JSON value with integer number
597 json j = i;
609 const auto result = json::to_msgpack(j);
619 CHECK(json::from_msgpack(result) == j);
632 // create JSON value with unsigned integer number
633 json j = i;
643 const auto result = json::to_cbor(j);
651 CHECK(json::from_cbor(result) == j);
652 CHECK(json::from_cbor(result, true, false) == j);
662 // create JSON value with unsigned integer number
663 json j = i;
674 const auto result = json::to_cbor(j);
684 CHECK(json::from_cbor(result) == j);
685 CHECK(json::from_cbor(result, true, false) == j);
695 // create JSON value with unsigned integer number
696 json j = i;
708 const auto result = json::to_cbor(j);
718 CHECK(json::from_cbor(result) == j);
719 CHECK(json::from_cbor(result, true, false) == j);
732 // create JSON value with unsigned integer number
733 json j = i;
747 const auto result = json::to_cbor(j);
760 CHECK(json::from_cbor(result) == j);
761 CHECK(json::from_cbor(result, true, false) == j);
774 // create JSON value with integer number
775 json j = i;
793 const auto result = json::to_cbor(j);
810 CHECK(json::from_cbor(result) == j);
811 CHECK(json::from_cbor(result, true, false) == j);
821 json j = v;
826 const auto result = json::to_cbor(j);
830 CHECK(json::from_cbor(result) == j);
831 CHECK(json::from_cbor(result) == v);
833 CHECK(json::from_cbor(result, true, false) == j);
842 json j = v;
847 const auto result = json::to_cbor(j);
850 CHECK(json::from_cbor(result) == j);
851 CHECK(json::from_cbor(result) == v);
856 json j = v;
860 const auto result = json::to_cbor(j);
863 CHECK(json::from_cbor(result) == j);
864 CHECK(json::from_cbor(result) == v);
869 json j = v;
873 const auto result = json::to_cbor(j);
876 CHECK(json::from_cbor(result) == j);
877 CHECK(json::from_cbor(result) == v);
882 json j = v;
886 const auto result = json::to_cbor(j);
889 CHECK(json::from_cbor(result) == j);
890 CHECK(json::from_cbor(result) == v);
895 json j = v;
899 const auto result = json::to_cbor(j);
902 CHECK(json::from_cbor(result) == j);
903 CHECK(json::from_cbor(result) == v);
908 json j = v;
913 const auto result = json::to_cbor(j);
916 CHECK(json::from_cbor(result) == j);
917 CHECK(json::from_cbor(result) == v);
922 json j = v;
927 const auto result = json::to_cbor(j);
930 CHECK(json::from_cbor(result) == j);
931 CHECK(json::from_cbor(result) == v);
936 json j = v;
942 const auto result = json::to_cbor(j);
945 CHECK(json::from_cbor(result) == j);
946 CHECK(json::from_cbor(result) == v);
951 json j = v;
957 const auto result = json::to_cbor(j);
960 CHECK(json::from_cbor(result) == j);
961 CHECK(json::from_cbor(result) == v);
972 json _;
973json::from_cbor(std::vector<uint8_t>({0xf9})), "[json.exception.parse_error.110] parse error at by…
974 … CHECK(json::from_cbor(std::vector<uint8_t>({0xf9}), true, false).is_discarded());
978 json _;
979json::from_cbor(std::vector<uint8_t>({0xf9, 0x7c})), "[json.exception.parse_error.110] parse error…
980 … CHECK(json::from_cbor(std::vector<uint8_t>({0xf9, 0x7c}), true, false).is_discarded());
988 json j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x00, 0x00}));
989 json::number_float_t d{j};
995 json j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x80, 0x00}));
996 json::number_float_t d{j};
1002 json j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x00, 0x01}));
1003 json::number_float_t d{j};
1012 json j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x7c, 0x00}));
1013 json::number_float_t d{j};
1014 CHECK(d == std::numeric_limits<json::number_float_t>::infinity());
1020 json j = json::from_cbor(std::vector<uint8_t>({0xf9, 0xfc, 0x00}));
1021 json::number_float_t d{j};
1022 CHECK(d == -std::numeric_limits<json::number_float_t>::infinity());
1031 json j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x3c, 0x00}));
1032 json::number_float_t d{j};
1038 json j = json::from_cbor(std::vector<uint8_t>({0xf9, 0xc0, 0x00}));
1039 json::number_float_t d{j};
1045 json j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x7b, 0xff}));
1046 json::number_float_t d{j};
1053 json j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x7c, 0x00}));
1054 json::number_float_t d{j};
1061 json j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x7e, 0x00}));
1062 json::number_float_t d{j};
1077 // create JSON value with string containing of N * 'x'
1079 json j = s;
1090 const auto result = json::to_cbor(j);
1100 CHECK(json::from_cbor(result) == j);
1101 CHECK(json::from_cbor(result, true, false) == j);
1111 // create JSON value with string containing of N * 'x'
1113 json j = s;
1125 const auto result = json::to_cbor(j);
1132 CHECK(json::from_cbor(result) == j);
1133 CHECK(json::from_cbor(result, true, false) == j);
1146 // create JSON value with string containing of N * 'x'
1148 json j = s;
1158 const auto result = json::to_cbor(j);
1165 CHECK(json::from_cbor(result) == j);
1166 CHECK(json::from_cbor(result, true, false) == j);
1179 // create JSON value with string containing of N * 'x'
1181 json j = s;
1193 const auto result = json::to_cbor(j);
1200 CHECK(json::from_cbor(result) == j);
1201 CHECK(json::from_cbor(result, true, false) == j);
1210 json j = json::array();
1212 const auto result = json::to_cbor(j);
1216 CHECK(json::from_cbor(result) == j);
1217 CHECK(json::from_cbor(result, true, false) == j);
1222 json j = {nullptr};
1224 const auto result = json::to_cbor(j);
1228 CHECK(json::from_cbor(result) == j);
1229 CHECK(json::from_cbor(result, true, false) == j);
1234 json j = json::parse("[1,2,3,4,5]");
1236 const auto result = json::to_cbor(j);
1240 CHECK(json::from_cbor(result) == j);
1241 CHECK(json::from_cbor(result, true, false) == j);
1246 json j = json::parse("[[[[]]]]");
1248 const auto result = json::to_cbor(j);
1252 CHECK(json::from_cbor(result) == j);
1253 CHECK(json::from_cbor(result, true, false) == j);
1258 json j(257, nullptr);
1263 const auto result = json::to_cbor(j);
1267 CHECK(json::from_cbor(result) == j);
1268 CHECK(json::from_cbor(result, true, false) == j);
1273 json j(65793, nullptr);
1280 const auto result = json::to_cbor(j);
1284 CHECK(json::from_cbor(result) == j);
1285 CHECK(json::from_cbor(result, true, false) == j);
1293 json j = json::object();
1295 const auto result = json::to_cbor(j);
1299 CHECK(json::from_cbor(result) == j);
1300 CHECK(json::from_cbor(result, true, false) == j);
1305 json j = {{"", nullptr}};
1307 const auto result = json::to_cbor(j);
1311 CHECK(json::from_cbor(result) == j);
1312 CHECK(json::from_cbor(result, true, false) == j);
1317 json j = json::parse(R"({"a": {"b": {"c": {}}}})");
1322 const auto result = json::to_cbor(j);
1326 CHECK(json::from_cbor(result) == j);
1327 CHECK(json::from_cbor(result, true, false) == j);
1332 json j;
1342 const auto result = json::to_cbor(j);
1353 CHECK(json::from_cbor(result) == j);
1354 CHECK(json::from_cbor(result, true, false) == j);
1359 json j;
1369 const auto result = json::to_cbor(j);
1382 CHECK(json::from_cbor(result) == j);
1383 CHECK(json::from_cbor(result, true, false) == j);
1388 json j;
1398 const auto result = json::to_cbor(j);
1413 CHECK(json::from_cbor(result) == j);
1414 CHECK(json::from_cbor(result, true, false) == j);
1426 // create JSON value with byte array containing of N * 'x'
1428 json j = json::binary(s);
1439 const auto result = json::to_cbor(j);
1449 CHECK(json::from_cbor(result) == j);
1450 CHECK(json::from_cbor(result, true, false) == j);
1460 // create JSON value with string containing of N * 'x'
1462 json j = json::binary(s);
1474 const auto result = json::to_cbor(j);
1481 CHECK(json::from_cbor(result) == j);
1482 CHECK(json::from_cbor(result, true, false) == j);
1495 // create JSON value with string containing of N * 'x'
1497 json j = json::binary(s);
1507 const auto result = json::to_cbor(j);
1514 CHECK(json::from_cbor(result) == j);
1515 CHECK(json::from_cbor(result, true, false) == j);
1528 // create JSON value with string containing of N * 'x'
1530 json j = json::binary(s);
1542 const auto result = json::to_cbor(j);
1549 CHECK(json::from_cbor(result) == j);
1550 CHECK(json::from_cbor(result, true, false) == j);
1557 auto j = json::from_cbor(input);
1559 auto k = json::binary({0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x99});
1560 CAPTURE(j.dump(0, ' ', false, json::error_handler_t::strict))
1568 json _;
1569 CHECK_NOTHROW(_ = json::from_cbor(input));
1576 json _;
1577 CHECK_NOTHROW(_ = json::from_cbor(input));
1587 …auto callback = [&binary_seen](int /*depth*/, json::parse_event_t /*event*/, json & parsed) noexce…
1596 json j;
1597 auto cbp = nlohmann::detail::json_sax_dom_callback_parser<json>(j, callback, true);
1598 CHECK(json::sax_parse(input, &cbp, json::input_format_t::cbor));
1612 json j = json::from_cbor(given);
1613 CHECK(j == json::binary(std::vector<uint8_t> {'a'}));
1621 json j = json::from_cbor(given);
1630 json j = json::from_cbor(given);
1631 CHECK(j == json::parse("[false]"));
1639 json j = json::from_cbor(given);
1640 CHECK(j == json::parse("{\"\": false}"));
1648 json _;
1649json::from_cbor(std::vector<uint8_t>()), "[json.exception.parse_error.110] parse error at byte 1: …
1650 CHECK(json::from_cbor(std::vector<uint8_t>(), true, false).is_discarded());
1655 json _;
1656json::from_cbor(std::vector<uint8_t>({0x18})), "[json.exception.parse_error.110] parse error at by…
1657json::from_cbor(std::vector<uint8_t>({0x19})), "[json.exception.parse_error.110] parse error at by…
1658json::from_cbor(std::vector<uint8_t>({0x19, 0x00})), "[json.exception.parse_error.110] parse error…
1659json::from_cbor(std::vector<uint8_t>({0x1a})), "[json.exception.parse_error.110] parse error at by…
1660json::from_cbor(std::vector<uint8_t>({0x1a, 0x00})), "[json.exception.parse_error.110] parse error…
1661json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x00})), "[json.exception.parse_error.110] parse…
1662json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x00, 0x00})), "[json.exception.parse_error.110]…
1663json::from_cbor(std::vector<uint8_t>({0x1b})), "[json.exception.parse_error.110] parse error at by…
1664json::from_cbor(std::vector<uint8_t>({0x1b, 0x00})), "[json.exception.parse_error.110] parse error…
1665json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00})), "[json.exception.parse_error.110] parse…
1666json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00})), "[json.exception.parse_error.110]…
1667json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00})), "[json.exception.parse_erro…
1668json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00})), "[json.exception.pars…
1669json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})), "[json.exceptio…
1670json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})), "[json.ex…
1671json::from_cbor(std::vector<uint8_t>({0x62})), "[json.exception.parse_error.110] parse error at by…
1672json::from_cbor(std::vector<uint8_t>({0x62, 0x60})), "[json.exception.parse_error.110] parse error…
1673json::from_cbor(std::vector<uint8_t>({0x7F})), "[json.exception.parse_error.110] parse error at by…
1674json::from_cbor(std::vector<uint8_t>({0x7F, 0x60})), "[json.exception.parse_error.110] parse error…
1675json::from_cbor(std::vector<uint8_t>({0x82, 0x01})), "[json.exception.parse_error.110] parse error…
1676json::from_cbor(std::vector<uint8_t>({0x9F, 0x01})), "[json.exception.parse_error.110] parse error…
1677json::from_cbor(std::vector<uint8_t>({0xBF, 0x61, 0x61, 0xF5})), "[json.exception.parse_error.110]…
1678json::from_cbor(std::vector<uint8_t>({0xA1, 0x61, 0X61})), "[json.exception.parse_error.110] parse…
1679json::from_cbor(std::vector<uint8_t>({0xBF, 0x61, 0X61})), "[json.exception.parse_error.110] parse…
1680json::from_cbor(std::vector<uint8_t>({0x5F})), "[json.exception.parse_error.110] parse error at by…
1681json::from_cbor(std::vector<uint8_t>({0x5F, 0x00})), "[json.exception.parse_error.113] parse error…
1682json::from_cbor(std::vector<uint8_t>({0x41})), "[json.exception.parse_error.110] parse error at by…
1684 CHECK(json::from_cbor(std::vector<uint8_t>({0x18}), true, false).is_discarded());
1685 CHECK(json::from_cbor(std::vector<uint8_t>({0x19}), true, false).is_discarded());
1686 CHECK(json::from_cbor(std::vector<uint8_t>({0x19, 0x00}), true, false).is_discarded());
1687 CHECK(json::from_cbor(std::vector<uint8_t>({0x1a}), true, false).is_discarded());
1688 CHECK(json::from_cbor(std::vector<uint8_t>({0x1a, 0x00}), true, false).is_discarded());
1689 … CHECK(json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x00}), true, false).is_discarded());
1690 …CHECK(json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x00, 0x00}), true, false).is_discarded());
1691 CHECK(json::from_cbor(std::vector<uint8_t>({0x1b}), true, false).is_discarded());
1692 CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00}), true, false).is_discarded());
1693 … CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00}), true, false).is_discarded());
1694 …CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00}), true, false).is_discarded());
1695 …CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00}), true, false).is_discar…
1696 …CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00}), true, false).is_…
1697 …CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}), true, fals…
1698 …CHECK(json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}), true…
1699 CHECK(json::from_cbor(std::vector<uint8_t>({0x62}), true, false).is_discarded());
1700 CHECK(json::from_cbor(std::vector<uint8_t>({0x62, 0x60}), true, false).is_discarded());
1701 CHECK(json::from_cbor(std::vector<uint8_t>({0x7F}), true, false).is_discarded());
1702 CHECK(json::from_cbor(std::vector<uint8_t>({0x7F, 0x60}), true, false).is_discarded());
1703 CHECK(json::from_cbor(std::vector<uint8_t>({0x82, 0x01}), true, false).is_discarded());
1704 CHECK(json::from_cbor(std::vector<uint8_t>({0x9F, 0x01}), true, false).is_discarded());
1705 …CHECK(json::from_cbor(std::vector<uint8_t>({0xBF, 0x61, 0x61, 0xF5}), true, false).is_discarded());
1706 … CHECK(json::from_cbor(std::vector<uint8_t>({0xA1, 0x61, 0x61}), true, false).is_discarded());
1707 … CHECK(json::from_cbor(std::vector<uint8_t>({0xBF, 0x61, 0x61}), true, false).is_discarded());
1708 CHECK(json::from_cbor(std::vector<uint8_t>({0x5F}), true, false).is_discarded());
1709 CHECK(json::from_cbor(std::vector<uint8_t>({0x5F, 0x00}), true, false).is_discarded());
1710 CHECK(json::from_cbor(std::vector<uint8_t>({0x41}), true, false).is_discarded());
1717 json _;
1718json::from_cbor(std::vector<uint8_t>({0x1c})), "[json.exception.parse_error.112] parse error at by…
1719 CHECK(json::from_cbor(std::vector<uint8_t>({0x1c}), true, false).is_discarded());
1721json::from_cbor(std::vector<uint8_t>({0xf8})), "[json.exception.parse_error.112] parse error at by…
1722 CHECK(json::from_cbor(std::vector<uint8_t>({0xf8}), true, false).is_discarded());
1765 json _;
1766 …CHECK_THROWS_AS(_ = json::from_cbor(std::vector<uint8_t>({static_cast<uint8_t>(byte)})), json::par…
1767 …CHECK(json::from_cbor(std::vector<uint8_t>({static_cast<uint8_t>(byte)}), true, false).is_discarde…
1774 json _;
1775json::from_cbor(std::vector<uint8_t>({0xa1, 0xff, 0x01})), "[json.exception.parse_error.113] parse…
1776 … CHECK(json::from_cbor(std::vector<uint8_t>({0xa1, 0xff, 0x01}), true, false).is_discarded());
1784 const auto result = json::from_cbor(vec, false);
1785 CHECK(result == json());
1786 CHECK(!json::from_cbor(vec, false, false).is_discarded());
1791 json _;
1792json::from_cbor(vec), "[json.exception.parse_error.110] parse error at byte 2: syntax error while …
1793 CHECK(json::from_cbor(vec, true, false).is_discarded());
1804 CHECK(!json::sax_parse(v, &scp, json::input_format_t::cbor));
1811 CHECK(!json::sax_parse(v, &scp, json::input_format_t::cbor));
1818 CHECK(!json::sax_parse(v, &scp, json::input_format_t::cbor));
1826 SECTION("sample.json")
1828 std::string filename = TEST_DATA_DIRECTORY "/json_testsuite/sample.json";
1830 // parse JSON file
1832 json j1 = json::parse(f_json);
1836 json j2;
1837 CHECK_NOTHROW(j2 = json::from_cbor(packed));
1839 // compare parsed JSON values
1847 json::to_cbor(j1, ss);
1848 json j3 = json::from_cbor(ss.str());
1855 json::to_cbor(j1, s);
1856 json j3 = json::from_cbor(s);
1863 CHECK(j1 == json::from_cbor(packed.begin() + 5, packed.end()));
1908 json j1 = json::from_cbor(vec1); in CAPTURE()
1913 std::vector<uint8_t> vec2 = json::to_cbor(j1); in CAPTURE()
1916 json j2 = json::from_cbor(vec2); in CAPTURE()
1921 catch (const json::parse_error&) in CAPTURE()
1927 catch (const json::parse_error&)
1942 exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/1.json"); in skip()
1943 exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/2.json"); in skip()
1944 exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/3.json"); in skip()
1945 exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/4.json"); in skip()
1946 exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/5.json"); in skip()
1947 exclude_packed.insert(TEST_DATA_DIRECTORY "/json_testsuite/sample.json"); // kills AppVeyor in skip()
1948 exclude_packed.insert(TEST_DATA_DIRECTORY "/json_tests/pass1.json"); in skip()
1949 exclude_packed.insert(TEST_DATA_DIRECTORY "/regression/working_file.json"); in skip()
1950 exclude_packed.insert(TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object.json"); in skip()
1951 …packed.insert(TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_duplicated_key.json"); in skip()
1952 …e_packed.insert(TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_long_strings.json"); in skip()
1956 TEST_DATA_DIRECTORY "/json_nlohmann_tests/all_unicode.json", in skip()
1957 TEST_DATA_DIRECTORY "/json.org/1.json", in skip()
1958 TEST_DATA_DIRECTORY "/json.org/2.json", in skip()
1959 TEST_DATA_DIRECTORY "/json.org/3.json", in skip()
1960 TEST_DATA_DIRECTORY "/json.org/4.json", in skip()
1961 TEST_DATA_DIRECTORY "/json.org/5.json", in skip()
1962 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip01.json", in skip()
1963 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip02.json", in skip()
1964 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip03.json", in skip()
1965 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip04.json", in skip()
1966 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip05.json", in skip()
1967 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip06.json", in skip()
1968 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip07.json", in skip()
1969 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip08.json", in skip()
1970 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip09.json", in skip()
1971 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip10.json", in skip()
1972 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip11.json", in skip()
1973 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip12.json", in skip()
1974 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip13.json", in skip()
1975 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip14.json", in skip()
1976 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip15.json", in skip()
1977 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip16.json", in skip()
1978 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip17.json", in skip()
1979 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip18.json", in skip()
1980 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip19.json", in skip()
1981 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip20.json", in skip()
1982 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip21.json", in skip()
1983 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip22.json", in skip()
1984 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip23.json", in skip()
1985 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip24.json", in skip()
1986 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip25.json", in skip()
1987 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip26.json", in skip()
1988 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip27.json", in skip()
1989 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip28.json", in skip()
1990 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip29.json", in skip()
1991 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip30.json", in skip()
1992 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip31.json", in skip()
1993 TEST_DATA_DIRECTORY "/json_roundtrip/roundtrip32.json", in skip()
1994 TEST_DATA_DIRECTORY "/json_testsuite/sample.json", // kills AppVeyor in skip()
1995 TEST_DATA_DIRECTORY "/json_tests/pass1.json", in skip()
1996 TEST_DATA_DIRECTORY "/json_tests/pass2.json", in skip()
1997 TEST_DATA_DIRECTORY "/json_tests/pass3.json", in skip()
1998 TEST_DATA_DIRECTORY "/regression/floats.json", in skip()
1999 TEST_DATA_DIRECTORY "/regression/signed_ints.json", in skip()
2000 TEST_DATA_DIRECTORY "/regression/unsigned_ints.json", in skip()
2001 TEST_DATA_DIRECTORY "/regression/working_file.json", in skip()
2002 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_arraysWithSpaces.json", in skip()
2003 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_empty-string.json", in skip()
2004 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_empty.json", in skip()
2005 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_ending_with_newline.json", in skip()
2006 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_false.json", in skip()
2007 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_heterogeneous.json", in skip()
2008 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_null.json", in skip()
2009 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_with_1_and_newline.json", in skip()
2010 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_with_leading_space.json", in skip()
2011 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_with_several_null.json", in skip()
2012 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_array_with_trailing_space.json", in skip()
2013 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number.json", in skip()
2014 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_0e+1.json", in skip()
2015 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_0e1.json", in skip()
2016 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_after_space.json", in skip()
2017 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_double_close_to_zero.json", in skip()
2018 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_double_huge_neg_exp.json", in skip()
2019 //TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_huge_exp.json", in skip()
2020 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_int_with_exp.json", in skip()
2021 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_minus_zero.json", in skip()
2022 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_negative_int.json", in skip()
2023 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_negative_one.json", in skip()
2024 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_negative_zero.json", in skip()
2025 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_capital_e.json", in skip()
2026 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_capital_e_neg_exp.json", in skip()
2027 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_capital_e_pos_exp.json", in skip()
2028 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_exponent.json", in skip()
2029 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_fraction_exponent.json", in skip()
2030 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_neg_exp.json", in skip()
2031 … //TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_neg_overflow.json", in skip()
2032 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_pos_exponent.json", in skip()
2033 … //TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_pos_overflow.json", in skip()
2034 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_real_underflow.json", in skip()
2035 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_simple_int.json", in skip()
2036 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_simple_real.json", in skip()
2037 … //TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_too_big_neg_int.json", in skip()
2038 … //TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_too_big_pos_int.json", in skip()
2039 … //TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_number_very_big_negative_int.json", in skip()
2040 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object.json", in skip()
2041 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_basic.json", in skip()
2042 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_duplicated_key.json", in skip()
2043 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_duplicated_key_and_value.json", in skip()
2044 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_empty.json", in skip()
2045 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_empty_key.json", in skip()
2046 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_escaped_null_in_key.json", in skip()
2047 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_extreme_numbers.json", in skip()
2048 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_long_strings.json", in skip()
2049 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_simple.json", in skip()
2050 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_string_unicode.json", in skip()
2051 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_with_newlines.json", in skip()
2052 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_1_2_3_bytes_UTF-8_sequences.json", in skip()
2053 …Y "/nst_json_testsuite/test_parsing/y_string_UTF-16_Surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json", in skip()
2054 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_accepted_surrogate_pair.json", in skip()
2055 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_accepted_surrogate_pairs.json", in skip()
2056 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_allowed_escapes.json", in skip()
2057 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_backslash_and_u_escaped_zero.json", in skip()
2058 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_backslash_doublequotes.json", in skip()
2059 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_comments.json", in skip()
2060 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_double_escape_a.json", in skip()
2061 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_double_escape_n.json", in skip()
2062 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_escaped_control_character.json", in skip()
2063 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_escaped_noncharacter.json", in skip()
2064 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_in_array.json", in skip()
2065 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_in_array_with_leading_space.json", in skip()
2066 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_last_surrogates_1_and_2.json", in skip()
2067 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_newline_uescaped.json", in skip()
2068 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_nonCharacterInUTF-8_U+10FFFF.json", in skip()
2069 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_nonCharacterInUTF-8_U+1FFFF.json", in skip()
2070 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_nonCharacterInUTF-8_U+FFFF.json", in skip()
2071 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_null_escape.json", in skip()
2072 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_one-byte-utf-8.json", in skip()
2073 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_pi.json", in skip()
2074 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_simple_ascii.json", in skip()
2075 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_space.json", in skip()
2076 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_three-byte-utf-8.json", in skip()
2077 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_two-byte-utf-8.json", in skip()
2078 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_u+2028_line_sep.json", in skip()
2079 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_u+2029_par_sep.json", in skip()
2080 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_uEscape.json", in skip()
2081 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unescaped_char_delete.json", in skip()
2082 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unicode.json", in skip()
2083 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unicodeEscapedBackslash.json", in skip()
2084 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unicode_2.json", in skip()
2085 …ST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json", in skip()
2086 …TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unicode_U+2064_invisible_plus.json", in skip()
2087 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_unicode_escaped_double_quote.json", in skip()
2088 // TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_utf16.json", in skip()
2089 TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_utf8.json", in skip()
2090 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_string_with_del_character.json", in skip()
2091 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_lonely_false.json", in skip()
2092 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_lonely_int.json", in skip()
2093 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_lonely_negative_real.json", in skip()
2094 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_lonely_null.json", in skip()
2095 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_lonely_string.json", in skip()
2096 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_lonely_true.json", in skip()
2097 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_string_empty.json", in skip()
2098 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_trailing_newline.json", in skip()
2099 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_true_in_array.json", in skip()
2100 … TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_structure_whitespace_array.json" in skip()
2107 // parse JSON file in skip()
2109 json j1 = json::parse(f_json); in skip()
2113 json j2; in skip()
2114 CHECK_NOTHROW(j2 = json::from_cbor(packed)); in skip()
2116 // compare parsed JSON values in skip()
2122 // parse JSON file in skip()
2124 json j1 = json::parse(f_json); in skip()
2128 json j2; in skip()
2129 CHECK_NOTHROW(j2 = json::from_cbor(f_cbor)); in skip()
2131 // compare parsed JSON values in skip()
2137 // parse JSON file in skip()
2139 json j1 = json::parse(f_json); in skip()
2143 json j2; in skip()
2144 CHECK_NOTHROW(j2 = json::from_cbor({packed.data(), packed.size()})); in skip()
2146 // compare parsed JSON values in skip()
2152 // parse JSON file in skip()
2154 json j1 = json::parse(f_json); in skip()
2164 json::to_cbor(j1, vec); in skip()
2226 auto res = json::from_cbor(std::vector<uint8_t>(1, byte));
2228 catch (const json::parse_error& e)
2250 CHECK(json::to_cbor(json::parse("0")) == std::vector<uint8_t>({0x00}));
2251 CHECK(json::parse("0") == json::from_cbor(std::vector<uint8_t>({0x00})));
2253 CHECK(json::to_cbor(json::parse("1")) == std::vector<uint8_t>({0x01}));
2254 CHECK(json::parse("1") == json::from_cbor(std::vector<uint8_t>({0x01})));
2256 CHECK(json::to_cbor(json::parse("10")) == std::vector<uint8_t>({0x0a}));
2257 CHECK(json::parse("10") == json::from_cbor(std::vector<uint8_t>({0x0a})));
2259 CHECK(json::to_cbor(json::parse("23")) == std::vector<uint8_t>({0x17}));
2260 CHECK(json::parse("23") == json::from_cbor(std::vector<uint8_t>({0x17})));
2262 CHECK(json::to_cbor(json::parse("24")) == std::vector<uint8_t>({0x18, 0x18}));
2263 CHECK(json::parse("24") == json::from_cbor(std::vector<uint8_t>({0x18, 0x18})));
2265 CHECK(json::to_cbor(json::parse("25")) == std::vector<uint8_t>({0x18, 0x19}));
2266 CHECK(json::parse("25") == json::from_cbor(std::vector<uint8_t>({0x18, 0x19})));
2268 CHECK(json::to_cbor(json::parse("100")) == std::vector<uint8_t>({0x18, 0x64}));
2269 CHECK(json::parse("100") == json::from_cbor(std::vector<uint8_t>({0x18, 0x64})));
2271 CHECK(json::to_cbor(json::parse("1000")) == std::vector<uint8_t>({0x19, 0x03, 0xe8}));
2272 CHECK(json::parse("1000") == json::from_cbor(std::vector<uint8_t>({0x19, 0x03, 0xe8})));
2274 …CHECK(json::to_cbor(json::parse("1000000")) == std::vector<uint8_t>({0x1a, 0x00, 0x0f, 0x42, 0x40}…
2275 …CHECK(json::parse("1000000") == json::from_cbor(std::vector<uint8_t>({0x1a, 0x00, 0x0f, 0x42, 0x40…
2277 …CHECK(json::to_cbor(json::parse("1000000000000")) == std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00,…
2278 …CHECK(json::parse("1000000000000") == json::from_cbor(std::vector<uint8_t>({0x1b, 0x00, 0x00, 0x00…
2280 …CHECK(json::to_cbor(json::parse("18446744073709551615")) == std::vector<uint8_t>({0x1b, 0xff, 0xff…
2281 …CHECK(json::parse("18446744073709551615") == json::from_cbor(std::vector<uint8_t>({0x1b, 0xff, 0xf…
2284 …//CHECK(json::to_cbor(json::parse("18446744073709551616")) == std::vector<uint8_t>({0xc2, 0x49, 0x…
2285 …//CHECK(json::parse("18446744073709551616") == json::from_cbor(std::vector<uint8_t>({0xc2, 0x49, 0…
2287 …//CHECK(json::to_cbor(json::parse("-18446744073709551616")) == std::vector<uint8_t>({0x3b, 0xff, 0…
2288 …//CHECK(json::parse("-18446744073709551616") == json::from_cbor(std::vector<uint8_t>({0x3b, 0xff, …
2291 …//CHECK(json::to_cbor(json::parse("-18446744073709551617")) == std::vector<uint8_t>({0xc3, 0x49, 0…
2292 …//CHECK(json::parse("-18446744073709551617") == json::from_cbor(std::vector<uint8_t>({0xc3, 0x49, …
2294 CHECK(json::to_cbor(json::parse("-1")) == std::vector<uint8_t>({0x20}));
2295 CHECK(json::parse("-1") == json::from_cbor(std::vector<uint8_t>({0x20})));
2297 CHECK(json::to_cbor(json::parse("-10")) == std::vector<uint8_t>({0x29}));
2298 CHECK(json::parse("-10") == json::from_cbor(std::vector<uint8_t>({0x29})));
2300 CHECK(json::to_cbor(json::parse("-100")) == std::vector<uint8_t>({0x38, 0x63}));
2301 CHECK(json::parse("-100") == json::from_cbor(std::vector<uint8_t>({0x38, 0x63})));
2303 CHECK(json::to_cbor(json::parse("-1000")) == std::vector<uint8_t>({0x39, 0x03, 0xe7}));
2304 CHECK(json::parse("-1000") == json::from_cbor(std::vector<uint8_t>({0x39, 0x03, 0xe7})));
2307 //CHECK(json::to_cbor(json::parse("0.0")) == std::vector<uint8_t>({0xf9, 0x00, 0x00}));
2308 CHECK(json::parse("0.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0x00, 0x00})));
2311 //CHECK(json::to_cbor(json::parse("-0.0")) == std::vector<uint8_t>({0xf9, 0x80, 0x00}));
2312 CHECK(json::parse("-0.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0x80, 0x00})));
2315 //CHECK(json::to_cbor(json::parse("1.0")) == std::vector<uint8_t>({0xf9, 0x3c, 0x00}));
2316 CHECK(json::parse("1.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0x3c, 0x00})));
2318 …CHECK(json::to_cbor(json::parse("1.1")) == std::vector<uint8_t>({0xfb, 0x3f, 0xf1, 0x99, 0x99, 0x9…
2319 …CHECK(json::parse("1.1") == json::from_cbor(std::vector<uint8_t>({0xfb, 0x3f, 0xf1, 0x99, 0x99, 0x…
2322 //CHECK(json::to_cbor(json::parse("1.5")) == std::vector<uint8_t>({0xf9, 0x3e, 0x00}));
2323 CHECK(json::parse("1.5") == json::from_cbor(std::vector<uint8_t>({0xf9, 0x3e, 0x00})));
2326 //CHECK(json::to_cbor(json::parse("65504.0")) == std::vector<uint8_t>({0xf9, 0x7b, 0xff}));
2327 CHECK(json::parse("65504.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0x7b, 0xff})));
2329 …//CHECK(json::to_cbor(json::parse("100000.0")) == std::vector<uint8_t>({0xfa, 0x47, 0xc3, 0x50, 0x…
2330 …CHECK(json::parse("100000.0") == json::from_cbor(std::vector<uint8_t>({0xfa, 0x47, 0xc3, 0x50, 0x0…
2332 …//CHECK(json::to_cbor(json::parse("3.4028234663852886e+38")) == std::vector<uint8_t>({0xfa, 0x7f, …
2333 …CHECK(json::parse("3.4028234663852886e+38") == json::from_cbor(std::vector<uint8_t>({0xfa, 0x7f, 0…
2335 …CHECK(json::to_cbor(json::parse("1.0e+300")) == std::vector<uint8_t>({0xfb, 0x7e, 0x37, 0xe4, 0x3c…
2336 …CHECK(json::parse("1.0e+300") == json::from_cbor(std::vector<uint8_t>({0xfb, 0x7e, 0x37, 0xe4, 0x3…
2339 …//CHECK(json::to_cbor(json::parse("5.960464477539063e-8")) == std::vector<uint8_t>({0xf9, 0x00, 0x…
2340 CHECK(json::parse("-4.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0xc4, 0x00})));
2343 …//CHECK(json::to_cbor(json::parse("0.00006103515625")) == std::vector<uint8_t>({0xf9, 0x04, 0x00})…
2344 CHECK(json::parse("-4.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0xc4, 0x00})));
2347 //CHECK(json::to_cbor(json::parse("-4.0")) == std::vector<uint8_t>({0xf9, 0xc4, 0x00}));
2348 CHECK(json::parse("-4.0") == json::from_cbor(std::vector<uint8_t>({0xf9, 0xc4, 0x00})));
2350 …CHECK(json::to_cbor(json::parse("-4.1")) == std::vector<uint8_t>({0xfb, 0xc0, 0x10, 0x66, 0x66, 0x…
2351 …CHECK(json::parse("-4.1") == json::from_cbor(std::vector<uint8_t>({0xfb, 0xc0, 0x10, 0x66, 0x66, 0…
2356 CHECK(json::to_cbor(json::parse("false")) == std::vector<uint8_t>({0xf4}));
2357 CHECK(json::parse("false") == json::from_cbor(std::vector<uint8_t>({0xf4})));
2359 CHECK(json::to_cbor(json::parse("true")) == std::vector<uint8_t>({0xf5}));
2360 CHECK(json::parse("true") == json::from_cbor(std::vector<uint8_t>({0xf5})));
2362 CHECK(json::to_cbor(json::parse("true")) == std::vector<uint8_t>({0xf5}));
2363 CHECK(json::parse("true") == json::from_cbor(std::vector<uint8_t>({0xf5})));
2368 CHECK(json::to_cbor(json::parse("\"\"")) == std::vector<uint8_t>({0x60}));
2369 CHECK(json::parse("\"\"") == json::from_cbor(std::vector<uint8_t>({0x60})));
2371 CHECK(json::to_cbor(json::parse("\"a\"")) == std::vector<uint8_t>({0x61, 0x61}));
2372 CHECK(json::parse("\"a\"") == json::from_cbor(std::vector<uint8_t>({0x61, 0x61})));
2374 …CHECK(json::to_cbor(json::parse("\"IETF\"")) == std::vector<uint8_t>({0x64, 0x49, 0x45, 0x54, 0x46…
2375 …CHECK(json::parse("\"IETF\"") == json::from_cbor(std::vector<uint8_t>({0x64, 0x49, 0x45, 0x54, 0x4…
2377 … CHECK(json::to_cbor(json::parse("\"\\u00fc\"")) == std::vector<uint8_t>({0x62, 0xc3, 0xbc}));
2378 … CHECK(json::parse("\"\\u00fc\"") == json::from_cbor(std::vector<uint8_t>({0x62, 0xc3, 0xbc})));
2380 …CHECK(json::to_cbor(json::parse("\"\\u6c34\"")) == std::vector<uint8_t>({0x63, 0xe6, 0xb0, 0xb4}));
2381 …CHECK(json::parse("\"\\u6c34\"") == json::from_cbor(std::vector<uint8_t>({0x63, 0xe6, 0xb0, 0xb4})…
2383 …CHECK(json::to_cbor(json::parse("\"\\ud800\\udd51\"")) == std::vector<uint8_t>({0x64, 0xf0, 0x90, …
2384 …CHECK(json::parse("\"\\ud800\\udd51\"") == json::from_cbor(std::vector<uint8_t>({0x64, 0xf0, 0x90,…
2387 …CHECK(json::parse("\"streaming\"") == json::from_cbor(std::vector<uint8_t>({0x7f, 0x65, 0x73, 0x74…
2393 json j;
2394 CHECK_NOTHROW(j = json::from_cbor(packed));
2397 CHECK(j == json::binary(expected));
2400 …CHECK(json::to_cbor(json::binary(std::vector<uint8_t> {}, 0x42)) == std::vector<uint8_t> {0xd8, 0x…
2401 …CHECK(!json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 0x42)), true, true, jso…
2402 …CHECK(json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 0x42)), true, true, json
2404 …CHECK(json::to_cbor(json::binary(std::vector<uint8_t> {}, 1000)) == std::vector<uint8_t> {0xd9, 0x…
2405 …CHECK(!json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 1000)), true, true, jso…
2406 …CHECK(json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 1000)), true, true, json
2408 …CHECK(json::to_cbor(json::binary(std::vector<uint8_t> {}, 394216)) == std::vector<uint8_t> {0xda, …
2409 …CHECK(!json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 394216)), true, true, j…
2410 …CHECK(json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 394216)), true, true, js…
2412 …CHECK(json::to_cbor(json::binary(std::vector<uint8_t> {}, 8589934590)) == std::vector<uint8_t> {0x…
2413 …CHECK(!json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 8589934590)), true, tru…
2414 …CHECK(json::from_cbor(json::to_cbor(json::binary(std::vector<uint8_t> {}, 8589934590)), true, true…
2419 CHECK(json::to_cbor(json::parse("[]")) == std::vector<uint8_t>({0x80}));
2420 CHECK(json::parse("[]") == json::from_cbor(std::vector<uint8_t>({0x80})));
2422 … CHECK(json::to_cbor(json::parse("[1, 2, 3]")) == std::vector<uint8_t>({0x83, 0x01, 0x02, 0x03}));
2423 …CHECK(json::parse("[1, 2, 3]") == json::from_cbor(std::vector<uint8_t>({0x83, 0x01, 0x02, 0x03})));
2425 …CHECK(json::to_cbor(json::parse("[1, [2, 3], [4, 5]]")) == std::vector<uint8_t>({0x83, 0x01, 0x82,…
2426 …CHECK(json::parse("[1, [2, 3], [4, 5]]") == json::from_cbor(std::vector<uint8_t>({0x83, 0x01, 0x82…
2428 …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…
2429 …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,…
2432 CHECK(json::parse("[]") == json::from_cbor(std::vector<uint8_t>({0x9f, 0xff})));
2433 …CHECK(json::parse("[1, [2, 3], [4, 5]] ") == json::from_cbor(std::vector<uint8_t>({0x9f, 0x01, 0x8…
2434 …CHECK(json::parse("[1, [2, 3], [4, 5]]") == json::from_cbor(std::vector<uint8_t>({0x9f, 0x01, 0x82…
2435 …CHECK(json::parse("[1, [2, 3], [4, 5]]") == json::from_cbor(std::vector<uint8_t>({0x83, 0x01, 0x82…
2436 …CHECK(json::parse("[1, [2, 3], [4, 5]]") == json::from_cbor(std::vector<uint8_t>({0x83, 0x01, 0x9f…
2437 …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,…
2442 CHECK(json::to_cbor(json::parse("{}")) == std::vector<uint8_t>({0xa0}));
2443 CHECK(json::parse("{}") == json::from_cbor(std::vector<uint8_t>({0xa0})));
2445 …CHECK(json::to_cbor(json::parse("{\"a\": 1, \"b\": [2, 3]}")) == std::vector<uint8_t>({0xa2, 0x61,…
2446 …CHECK(json::parse("{\"a\": 1, \"b\": [2, 3]}") == json::from_cbor(std::vector<uint8_t>({0xa2, 0x61…
2448 …CHECK(json::to_cbor(json::parse("[\"a\", {\"b\": \"c\"}]")) == std::vector<uint8_t>({0x82, 0x61, 0…
2449 …CHECK(json::parse("[\"a\", {\"b\": \"c\"}]") == json::from_cbor(std::vector<uint8_t>({0x82, 0x61, …
2451 …CHECK(json::to_cbor(json::parse("{\"a\": \"A\", \"b\": \"B\", \"c\": \"C\", \"d\": \"D\", \"e\": \…
2452 …CHECK(json::parse("{\"a\": \"A\", \"b\": \"B\", \"c\": \"C\", \"d\": \"D\", \"e\": \"E\"}") == jso…
2455 …CHECK(json::parse("{\"a\": 1, \"b\": [2, 3]}") == json::from_cbor(std::vector<uint8_t>({0xbf, 0x61…
2456 …CHECK(json::parse("[\"a\", {\"b\": \"c\"}]") == json::from_cbor(std::vector<uint8_t>({0x82, 0x61, …
2457 …CHECK(json::parse("{\"Fun\": true, \"Amt\": -2}") == json::from_cbor(std::vector<uint8_t>({0xbf, 0…
2463 json j = "s";
2464 auto v = json::to_cbor(j);
2480 json _;
2481 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2482 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2485 auto j_tagged = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore);
2488 … auto j_tagged_stored = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::store);
2503 json _;
2504 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2505 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2508 auto j_tagged = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore);
2519 json _;
2520 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2521 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2522 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore), json:…
2537 json _;
2538 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2539 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2542 auto j_tagged = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore);
2554 json _;
2555 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2556 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2557 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore), json:…
2574 json _;
2575 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2576 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2579 auto j_tagged = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore);
2593 json _;
2594 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2595 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2596 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore), json:…
2617 json _;
2618 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2619 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2622 auto j_tagged = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore);
2640 json _;
2641 CHECK_THROWS_AS(_ = json::from_cbor(v_tagged), json::parse_error);
2642 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::error), json::…
2643 …CHECK_THROWS_AS(_ = json::from_cbor(v_tagged, true, true, json::cbor_tag_handler_t::ignore), json:…
2650 json j_binary;
2651 j_binary["binary"] = json::binary({0xCA, 0xFE, 0xBA, 0xBE}, 42);
2654 const auto vec = json::to_cbor(j_binary);
2658 json _;
2659 …(_ = json::from_cbor(vec), "[json.exception.parse_error.112] parse error at byte 9: syntax error w…
2662 json jb = json::from_cbor(vec, true, true, json::cbor_tag_handler_t::ignore);