xref: /third_party/json/tests/src/unit-meta.cpp (revision c5f01b2f)
1//     __ _____ _____ _____
2//  __|  |   __|     |   | |  JSON for Modern C++ (supporting code)
3// |  |  |__   |  |  | | | |  version 3.11.2
4// |_____|_____|_____|_|___|  https://github.com/nlohmann/json
5//
6// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
7// SPDX-License-Identifier: MIT
8
9#include "doctest_compatibility.h"
10
11#include <nlohmann/json.hpp>
12using nlohmann::json;
13
14TEST_CASE("version information")
15{
16    SECTION("meta()")
17    {
18        json j = json::meta();
19
20        CHECK(j["name"] == "JSON for Modern C++");
21        CHECK(j["copyright"] == "(C) 2013-2022 Niels Lohmann");
22        CHECK(j["url"] == "https://github.com/nlohmann/json");
23        CHECK(j["version"] == json(
24        {
25            {"string", "3.11.2"},
26            {"major", 3},
27            {"minor", 11},
28            {"patch", 2}
29        }));
30
31        CHECK(j.find("platform") != j.end());
32        CHECK(j.at("compiler").find("family") != j.at("compiler").end());
33        CHECK(j.at("compiler").find("version") != j.at("compiler").end());
34        CHECK(j.at("compiler").find("c++") != j.at("compiler").end());
35    }
36}
37