Fix narrowing of the optimized-container count in BJData and UBJSON tests

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-26 06:52:50 +01:00
1 parent 24ff6eaa43
commit d3d39a9c10
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -4637,7 +4637,7 @@ TEST_CASE("BJData optimized container type marker is validated for count 0")
{'[', '{'
})
{
for (const std::uint8_t count :
for (const int count :
{
0, 1
})
@@ -4645,7 +4645,7 @@ TEST_CASE("BJData optimized container type marker is validated for count 0")
CAPTURE(marker)
CAPTURE(open)
CAPTURE(count)
const std::vector<std::uint8_t> v = {static_cast<std::uint8_t>(open), '$', static_cast<std::uint8_t>(marker), '#', 'i', count};
const std::vector<std::uint8_t> v = {static_cast<std::uint8_t>(open), '$', static_cast<std::uint8_t>(marker), '#', 'i', static_cast<std::uint8_t>(count)};
json _;
CHECK_THROWS_AS(_ = json::from_bjdata(v), json::parse_error&);
CHECK(json::from_bjdata(v, true, false).is_discarded());
+2 -2
View File
@@ -3362,7 +3362,7 @@ TEST_CASE("UBJSON optimized container type marker is validated for count 0")
{'[', '{'
})
{
for (const std::uint8_t count :
for (const int count :
{
0, 1
})
@@ -3370,7 +3370,7 @@ TEST_CASE("UBJSON optimized container type marker is validated for count 0")
CAPTURE(marker)
CAPTURE(open)
CAPTURE(count)
const std::vector<std::uint8_t> v = {static_cast<std::uint8_t>(open), '$', static_cast<std::uint8_t>(marker), '#', 'i', count};
const std::vector<std::uint8_t> v = {static_cast<std::uint8_t>(open), '$', static_cast<std::uint8_t>(marker), '#', 'i', static_cast<std::uint8_t>(count)};
json _;
CHECK_THROWS_AS(_ = json::from_ubjson(v), json::parse_error&);
CHECK(json::from_ubjson(v, true, false).is_discarded());