mirror of
https://github.com/nlohmann/json.git
synced 2026-09-30 14:05:18 +00:00
Format the comparison examples with the pinned astyle
The "check" job runs astyle over the documentation examples once it gets past the amalgamation step. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -10,9 +10,9 @@ int main()
|
||||
// directly as views, without ever building a nlohmann::json value for
|
||||
// either one
|
||||
const json_document previous = json_document::parse(
|
||||
R"({"name": "cache", "port": 6379, "timeout": 30})");
|
||||
R"({"name": "cache", "port": 6379, "timeout": 30})");
|
||||
const json_document current = json_document::parse(
|
||||
R"({"port": 6379.0, "timeout": 30, "name": "cache"})");
|
||||
R"({"port": 6379.0, "timeout": 30, "name": "cache"})");
|
||||
|
||||
// same members, reordered, and 6379 written as a float -- operator==
|
||||
// treats them the same way BasicJsonType::operator== would
|
||||
@@ -20,7 +20,7 @@ int main()
|
||||
|
||||
// an actually changed value is detected the same way
|
||||
const json_document changed = json_document::parse(
|
||||
R"({"name": "cache", "port": 6380, "timeout": 30})");
|
||||
R"({"name": "cache", "port": 6380, "timeout": 30})");
|
||||
std::cout << (previous.root() == changed.root()) << '\n';
|
||||
|
||||
// comparing a view directly against an expected json value -- handy in a
|
||||
|
||||
@@ -11,7 +11,7 @@ int main()
|
||||
// unwanted shape -- without ever materializing it into a json value just
|
||||
// to compare
|
||||
const json_document received = json_document::parse(
|
||||
R"({"status": "ok", "code": 200})");
|
||||
R"({"status": "ok", "code": 200})");
|
||||
const json unwanted = {{"status", "error"}, {"code", 500}};
|
||||
std::cout << std::boolalpha << (received.root() != unwanted) << '\n';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user