unit-meta.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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. #include "doctest_compatibility.h"
  9. #include <nlohmann/json.hpp>
  10. using nlohmann::json;
  11. TEST_CASE("version information")
  12. {
  13. SECTION("meta()")
  14. {
  15. json j = json::meta();
  16. CHECK(j["name"] == "JSON for Modern C++");
  17. CHECK(j["copyright"] == "(C) 2013-2022 Niels Lohmann");
  18. CHECK(j["url"] == "https://github.com/nlohmann/json");
  19. CHECK(j["version"] == json(
  20. {
  21. {"string", "3.11.2"},
  22. {"major", 3},
  23. {"minor", 11},
  24. {"patch", 2}
  25. }));
  26. CHECK(j.find("platform") != j.end());
  27. CHECK(j.at("compiler").find("family") != j.at("compiler").end());
  28. CHECK(j.at("compiler").find("version") != j.at("compiler").end());
  29. CHECK(j.at("compiler").find("c++") != j.at("compiler").end());
  30. }
  31. }