Fix the tests for disabled implicit conversions and strict NUL handling
- unit-iterators1 (#5835) converted a json element to int implicitly, which does not compile with JSON_USE_IMPLICIT_CONVERSIONS=0. - unit-testsuites parses a number followed by a NUL byte, which JSON_STRICT_NUL_HANDLING rejects; leave the NUL out in strict mode. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
2 files changed
+5
-1
No files matched your search
@@ -1661,7 +1661,7 @@ TEST_CASE_TEMPLATE("reverse iteration and member access", Json, nlohmann::json,
|
||||
seen.clear();
|
||||
for (auto r = j.crbegin(); r != j.crend(); ++r)
|
||||
{
|
||||
seen.push_back(*r);
|
||||
seen.push_back(r->template get<int>());
|
||||
}
|
||||
CHECK(seen == std::vector<int> {4, 3, 2, 1});
|
||||
}
|
||||
|
||||
@@ -218,7 +218,11 @@ TEST_CASE("compliance tests from nativejson-benchmark")
|
||||
n1e308[0] = '[';
|
||||
n1e308[1] = '1';
|
||||
n1e308[310] = ']';
|
||||
#if JSON_STRICT_NUL_HANDLING
|
||||
n1e308.resize(311); // a NUL byte after the value is a syntax error in strict mode
|
||||
#else
|
||||
n1e308[311] = '\0';
|
||||
#endif
|
||||
TEST_DOUBLE(n1e308, 1E308);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user