mirror of
https://github.com/nlohmann/json.git
synced 2025-07-29 23:01:16 +03:00
🔀 merge develop
This commit is contained in:
@ -621,7 +621,7 @@ TEST_CASE("BSON input/output_adapters")
|
||||
{
|
||||
SECTION("std::ostringstream")
|
||||
{
|
||||
std::basic_ostringstream<std::uint8_t> ss;
|
||||
std::basic_ostringstream<char> ss;
|
||||
json::to_bson(json_representation, ss);
|
||||
json j3 = json::from_bson(ss.str());
|
||||
CHECK(json_representation == j3);
|
||||
|
@ -1880,7 +1880,7 @@ TEST_CASE("single CBOR roundtrip")
|
||||
{
|
||||
SECTION("std::ostringstream")
|
||||
{
|
||||
std::basic_ostringstream<std::uint8_t> ss;
|
||||
std::basic_ostringstream<char> ss;
|
||||
json::to_cbor(j1, ss);
|
||||
json j3 = json::from_cbor(ss.str());
|
||||
CHECK(j1 == j3);
|
||||
|
@ -20,6 +20,7 @@ using nlohmann::json;
|
||||
#include <sstream>
|
||||
#include <valarray>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
struct SaxEventLogger : public nlohmann::json_sax<json>
|
||||
@ -1131,13 +1132,15 @@ TEST_CASE("deserialization")
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE_TEMPLATE("deserialization of different character types (ASCII)", T, // NOLINT(readability-math-missing-parentheses)
|
||||
char, unsigned char, signed char,
|
||||
wchar_t,
|
||||
char16_t, char32_t,
|
||||
std::uint8_t, std::int8_t,
|
||||
std::int16_t, std::uint16_t,
|
||||
std::int32_t, std::uint32_t)
|
||||
// select the types to test - char8_t is only available in C++20
|
||||
#define TYPE_LIST(...) __VA_ARGS__
|
||||
#ifdef JSON_HAS_CPP_20
|
||||
#define ASCII_TYPES TYPE_LIST(char, wchar_t, char16_t, char32_t, char8_t)
|
||||
#else
|
||||
#define ASCII_TYPES TYPE_LIST(char, wchar_t, char16_t, char32_t)
|
||||
#endif
|
||||
|
||||
TEST_CASE_TEMPLATE("deserialization of different character types (ASCII)", T, ASCII_TYPES) // NOLINT(readability-math-missing-parentheses)
|
||||
{
|
||||
std::vector<T> const v = {'t', 'r', 'u', 'e'};
|
||||
CHECK(json::parse(v) == json(true));
|
||||
@ -1150,7 +1153,7 @@ TEST_CASE_TEMPLATE("deserialization of different character types (ASCII)", T, //
|
||||
}
|
||||
|
||||
TEST_CASE_TEMPLATE("deserialization of different character types (UTF-8)", T, // NOLINT(readability-math-missing-parentheses)
|
||||
char, unsigned char, std::uint8_t)
|
||||
char, unsigned char, std::uint8_t)// NOLINT(readability-math-missing-parentheses)
|
||||
{
|
||||
// a star emoji
|
||||
std::vector<T> const v = {'"', static_cast<T>(0xe2u), static_cast<T>(0xadu), static_cast<T>(0x90u), static_cast<T>(0xefu), static_cast<T>(0xb8u), static_cast<T>(0x8fu), '"'};
|
||||
@ -1163,7 +1166,7 @@ TEST_CASE_TEMPLATE("deserialization of different character types (UTF-8)", T, //
|
||||
}
|
||||
|
||||
TEST_CASE_TEMPLATE("deserialization of different character types (UTF-16)", T, // NOLINT(readability-math-missing-parentheses)
|
||||
char16_t, std::uint16_t)
|
||||
char16_t) // NOLINT(readability-math-missing-parentheses)
|
||||
{
|
||||
// a star emoji
|
||||
std::vector<T> const v = {static_cast<T>('"'), static_cast<T>(0x2b50), static_cast<T>(0xfe0f), static_cast<T>('"')};
|
||||
@ -1176,7 +1179,7 @@ TEST_CASE_TEMPLATE("deserialization of different character types (UTF-16)", T, /
|
||||
}
|
||||
|
||||
TEST_CASE_TEMPLATE("deserialization of different character types (UTF-32)", T, // NOLINT(readability-math-missing-parentheses)
|
||||
char32_t, std::uint32_t)
|
||||
char32_t) // NOLINT(readability-math-missing-parentheses)
|
||||
{
|
||||
// a star emoji
|
||||
std::vector<T> const v = {static_cast<T>('"'), static_cast<T>(0x2b50), static_cast<T>(0xfe0f), static_cast<T>('"')};
|
||||
|
@ -1604,7 +1604,7 @@ TEST_CASE("single MessagePack roundtrip")
|
||||
{
|
||||
SECTION("std::ostringstream")
|
||||
{
|
||||
std::basic_ostringstream<std::uint8_t> ss;
|
||||
std::basic_ostringstream<char> ss;
|
||||
json::to_msgpack(j1, ss);
|
||||
json j3 = json::from_msgpack(ss.str());
|
||||
CHECK(j1 == j3);
|
||||
|
@ -675,6 +675,7 @@ TEST_CASE("regression tests 2")
|
||||
}
|
||||
|
||||
#ifdef JSON_HAS_CPP_20
|
||||
#ifndef _LIBCPP_VERSION // see https://github.com/nlohmann/json/issues/4490
|
||||
#if __has_include(<span>)
|
||||
SECTION("issue #2546 - parsing containers of std::byte")
|
||||
{
|
||||
@ -684,6 +685,7 @@ TEST_CASE("regression tests 2")
|
||||
CHECK(j.dump() == "\"Hello, world!\"");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
SECTION("issue #2574 - Deserialization to std::array, std::pair, and std::tuple with non-default constructable types fails")
|
||||
|
@ -472,7 +472,7 @@ TEST_CASE_TEMPLATE("Serialization/deserialization via NLOHMANN_DEFINE_TYPE_INTRU
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE_TEMPLATE("Serialization/deserialization via NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE and NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE", T,
|
||||
TEST_CASE_TEMPLATE("Serialization/deserialization via NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE and NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE", T, // NOLINT(readability-math-missing-parentheses)
|
||||
persons::derived_person_with_private_data,
|
||||
persons::derived_person_without_private_data_1,
|
||||
persons::derived_person_without_private_data_2)
|
||||
|
Reference in New Issue
Block a user