Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions src/test_lib_json/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1819,7 +1819,7 @@ JSONTEST_FIXTURE_LOCAL(ValueTest, StaticString) {

JSONTEST_FIXTURE_LOCAL(ValueTest, WideString) {
// https://github.com/open-source-parsers/jsoncpp/issues/756
const std::string uni = u8"式,进"; // "\u5f0f\uff0c\u8fdb"
const std::string uni = u8"\u5f0f\uff0c\u8fdb"; // "式,进"
std::string styled;
{
Json::Value v;
Expand Down Expand Up @@ -2655,13 +2655,13 @@ struct ReaderTest : JsonTest::TestCase {
void checkStructuredErrors(
const std::vector<Json::Reader::StructuredError>& actual,
const std::vector<Json::Reader::StructuredError>& expected) {
JSONTEST_ASSERT_EQUAL(actual.size(), expected.size());
JSONTEST_ASSERT_EQUAL(expected.size(), actual.size());
for (size_t i = 0; i < actual.size(); ++i) {
const auto& a = actual[i];
const auto& e = expected[i];
JSONTEST_ASSERT_EQUAL(a.offset_start, e.offset_start) << i;
JSONTEST_ASSERT_EQUAL(a.offset_limit, e.offset_limit) << i;
JSONTEST_ASSERT_EQUAL(a.message, e.message) << i;
JSONTEST_ASSERT_EQUAL(e.offset_start, a.offset_start) << i;
JSONTEST_ASSERT_EQUAL(e.offset_limit, a.offset_limit) << i;
JSONTEST_ASSERT_EQUAL(e.message, a.message) << i;
}
}

Expand All @@ -2682,7 +2682,7 @@ struct ReaderTest : JsonTest::TestCase {
const std::vector<Json::Reader::StructuredError>& structured,
const std::string& formatted) {
checkParse(input, structured);
JSONTEST_ASSERT_EQUAL(reader->getFormattedErrorMessages(), formatted);
JSONTEST_ASSERT_EQUAL(formatted, reader->getFormattedErrorMessages());
}

std::unique_ptr<Json::Reader> reader{new Json::Reader()};
Expand Down Expand Up @@ -2771,8 +2771,8 @@ JSONTEST_FIXTURE_LOCAL(ReaderTest, parseWithNoErrorsTestingOffsets) {
R"( "false" : false)"
R"( })");
auto checkOffsets = [&](const Json::Value& v, int start, int limit) {
JSONTEST_ASSERT_EQUAL(v.getOffsetStart(), start);
JSONTEST_ASSERT_EQUAL(v.getOffsetLimit(), limit);
JSONTEST_ASSERT_EQUAL(start, v.getOffsetStart());
JSONTEST_ASSERT_EQUAL(limit, v.getOffsetLimit());
};
checkOffsets(root, 0, 115);
checkOffsets(root["property"], 15, 34);
Expand Down Expand Up @@ -2817,9 +2817,8 @@ JSONTEST_FIXTURE_LOCAL(ReaderTest, strictModeParseNumber) {
}

JSONTEST_FIXTURE_LOCAL(ReaderTest, parseChineseWithOneError) {
// \u4f50\u85e4 佐藤
checkParse(R"({ "pr)"
"佐藤"
u8"\u4f50\u85e4" // 佐藤
R"(erty" :: "value" })",
{{18, 19, "Syntax error: value, object or array expected."}},
"* Line 1, Column 19\n Syntax error: value, object or array "
Expand Down Expand Up @@ -2921,7 +2920,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
JSONTEST_ASSERT(ok);
JSONTEST_ASSERT(errs.empty());
JSONTEST_ASSERT_EQUAL("訪", root[0].asString()); // "\u8A2a"
JSONTEST_ASSERT_EQUAL(u8"\u8A2a", root[0].asString()); // ""
}
{
char const doc[] = "[ \"\\uD801\" ]";
Expand Down Expand Up @@ -3633,8 +3632,8 @@ JSONTEST_FIXTURE_LOCAL(IteratorTest, distance) {
}
{
Json::Value empty;
JSONTEST_ASSERT_EQUAL(empty.end() - empty.end(), 0);
JSONTEST_ASSERT_EQUAL(empty.end() - empty.begin(), 0);
JSONTEST_ASSERT_EQUAL(0, empty.end() - empty.end());
JSONTEST_ASSERT_EQUAL(0, empty.end() - empty.begin());
}
}

Expand Down