mirror of
https://github.com/nlohmann/json.git
synced 2026-03-02 07:16:24 +00:00
Update to Doctest 2.4.12 (#4771)
* ⬆️ Doctest 2.4.12 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warnings Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -1022,21 +1022,21 @@ TEST_CASE("CBOR")
|
||||
SECTION("0 (0 00000 0000000000)")
|
||||
{
|
||||
json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x00, 0x00}));
|
||||
json::number_float_t d{j};
|
||||
const json::number_float_t d{j};
|
||||
CHECK(d == 0.0);
|
||||
}
|
||||
|
||||
SECTION("-0 (1 00000 0000000000)")
|
||||
{
|
||||
json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x80, 0x00}));
|
||||
json::number_float_t d{j};
|
||||
const json::number_float_t d{j};
|
||||
CHECK(d == -0.0);
|
||||
}
|
||||
|
||||
SECTION("2**-24 (0 00000 0000000001)")
|
||||
{
|
||||
json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x00, 0x01}));
|
||||
json::number_float_t d{j};
|
||||
const json::number_float_t d{j};
|
||||
CHECK(d == std::pow(2.0, -24.0));
|
||||
}
|
||||
}
|
||||
@@ -1046,7 +1046,7 @@ TEST_CASE("CBOR")
|
||||
SECTION("infinity (0 11111 0000000000)")
|
||||
{
|
||||
json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x7c, 0x00}));
|
||||
json::number_float_t d{j};
|
||||
const json::number_float_t d{j};
|
||||
CHECK(d == std::numeric_limits<json::number_float_t>::infinity());
|
||||
CHECK(j.dump() == "null");
|
||||
}
|
||||
@@ -1054,7 +1054,7 @@ TEST_CASE("CBOR")
|
||||
SECTION("-infinity (1 11111 0000000000)")
|
||||
{
|
||||
json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0xfc, 0x00}));
|
||||
json::number_float_t d{j};
|
||||
const json::number_float_t d{j};
|
||||
CHECK(d == -std::numeric_limits<json::number_float_t>::infinity());
|
||||
CHECK(j.dump() == "null");
|
||||
}
|
||||
@@ -1065,21 +1065,21 @@ TEST_CASE("CBOR")
|
||||
SECTION("1 (0 01111 0000000000)")
|
||||
{
|
||||
json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x3c, 0x00}));
|
||||
json::number_float_t d{j};
|
||||
const json::number_float_t d{j};
|
||||
CHECK(d == 1);
|
||||
}
|
||||
|
||||
SECTION("-2 (1 10000 0000000000)")
|
||||
{
|
||||
json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0xc0, 0x00}));
|
||||
json::number_float_t d{j};
|
||||
const json::number_float_t d{j};
|
||||
CHECK(d == -2);
|
||||
}
|
||||
|
||||
SECTION("65504 (0 11110 1111111111)")
|
||||
{
|
||||
json const j = json::from_cbor(std::vector<uint8_t>({0xf9, 0x7b, 0xff}));
|
||||
json::number_float_t d{j};
|
||||
const json::number_float_t d{j};
|
||||
CHECK(d == 65504);
|
||||
}
|
||||
}
|
||||
@@ -1942,7 +1942,7 @@ TEST_CASE("CBOR regressions")
|
||||
{
|
||||
// parse CBOR file
|
||||
auto vec1 = utils::read_binary_file(filename);
|
||||
json j1 = json::from_cbor(vec1);
|
||||
const json j1 = json::from_cbor(vec1);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -2143,7 +2143,7 @@ TEST_CASE("CBOR roundtrips" * doctest::skip())
|
||||
INFO_WITH_TEMP(filename + ": std::vector<uint8_t>");
|
||||
// parse JSON file
|
||||
std::ifstream f_json(filename);
|
||||
json j1 = json::parse(f_json);
|
||||
const json j1 = json::parse(f_json);
|
||||
|
||||
// parse CBOR file
|
||||
const auto packed = utils::read_binary_file(filename + ".cbor");
|
||||
@@ -2158,7 +2158,7 @@ TEST_CASE("CBOR roundtrips" * doctest::skip())
|
||||
INFO_WITH_TEMP(filename + ": std::ifstream");
|
||||
// parse JSON file
|
||||
std::ifstream f_json(filename);
|
||||
json j1 = json::parse(f_json);
|
||||
const json j1 = json::parse(f_json);
|
||||
|
||||
// parse CBOR file
|
||||
std::ifstream f_cbor(filename + ".cbor", std::ios::binary);
|
||||
@@ -2173,7 +2173,7 @@ TEST_CASE("CBOR roundtrips" * doctest::skip())
|
||||
INFO_WITH_TEMP(filename + ": uint8_t* and size");
|
||||
// parse JSON file
|
||||
std::ifstream f_json(filename);
|
||||
json j1 = json::parse(f_json);
|
||||
const json j1 = json::parse(f_json);
|
||||
|
||||
// parse CBOR file
|
||||
const auto packed = utils::read_binary_file(filename + ".cbor");
|
||||
|
||||
Reference in New Issue
Block a user