2022-07-20 13:38:07 +03:00
|
|
|
// __ _____ _____ _____
|
|
|
|
|
// __| | __| | | | JSON for Modern C++ (supporting code)
|
2023-11-29 00:36:31 +03:00
|
|
|
// | | |__ | | | | | | version 3.11.3
|
2022-07-20 13:38:07 +03:00
|
|
|
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
|
|
|
|
|
//
|
2023-11-26 17:51:19 +03:00
|
|
|
// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
|
2022-07-20 13:38:07 +03:00
|
|
|
// SPDX-License-Identifier: MIT
|
2016-12-30 16:02:51 +03:00
|
|
|
|
2019-01-13 19:41:21 +03:00
|
|
|
#include "doctest_compatibility.h"
|
2016-12-30 16:02:51 +03:00
|
|
|
|
2018-01-29 13:21:11 +03:00
|
|
|
#include <nlohmann/json.hpp>
|
2016-12-30 16:02:51 +03:00
|
|
|
using nlohmann::json;
|
|
|
|
|
|
|
|
|
|
TEST_CASE("version information")
|
|
|
|
|
{
|
2017-02-26 16:34:58 +03:00
|
|
|
SECTION("meta()")
|
2016-12-30 16:02:51 +03:00
|
|
|
{
|
2017-02-26 16:34:58 +03:00
|
|
|
json j = json::meta();
|
|
|
|
|
|
|
|
|
|
CHECK(j["name"] == "JSON for Modern C++");
|
2023-11-29 00:36:31 +03:00
|
|
|
CHECK(j["copyright"] == "(C) 2013-2023 Niels Lohmann");
|
2017-02-26 16:34:58 +03:00
|
|
|
CHECK(j["url"] == "https://github.com/nlohmann/json");
|
|
|
|
|
CHECK(j["version"] == json(
|
2017-02-25 18:34:38 +03:00
|
|
|
{
|
2023-11-29 00:36:31 +03:00
|
|
|
{"string", "3.11.3"},
|
2017-12-17 10:31:18 +03:00
|
|
|
{"major", 3},
|
2022-08-01 00:19:06 +03:00
|
|
|
{"minor", 11},
|
2023-11-29 00:36:31 +03:00
|
|
|
{"patch", 3}
|
2017-02-25 18:34:38 +03:00
|
|
|
}));
|
2017-10-22 09:53:27 +03:00
|
|
|
|
|
|
|
|
CHECK(j.find("platform") != j.end());
|
|
|
|
|
CHECK(j.at("compiler").find("family") != j.at("compiler").end());
|
|
|
|
|
CHECK(j.at("compiler").find("version") != j.at("compiler").end());
|
|
|
|
|
CHECK(j.at("compiler").find("c++") != j.at("compiler").end());
|
2016-12-30 16:02:51 +03:00
|
|
|
}
|
|
|
|
|
}
|