json/tests/src/unit-meta.cpp

37 lines
1.1 KiB
C++
Raw Normal View History

// __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
2023-11-29 00:36:31 +03:00
// | | |__ | | | | | | version 3.11.3
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
2016-12-30 16:02:51 +03:00
#include "doctest_compatibility.h"
2016-12-30 16:02:51 +03:00
#include <nlohmann/json.hpp>
2016-12-30 16:02:51 +03:00
using nlohmann::json;
TEST_CASE("version information")
{
SECTION("meta()")
2016-12-30 16:02:51 +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");
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
}));
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
}
}