1c5f01b2fSopenharmony_ci// __ _____ _____ _____ 2c5f01b2fSopenharmony_ci// __| | __| | | | JSON for Modern C++ (supporting code) 3c5f01b2fSopenharmony_ci// | | |__ | | | | | | version 3.11.2 4c5f01b2fSopenharmony_ci// |_____|_____|_____|_|___| https://github.com/nlohmann/json 5c5f01b2fSopenharmony_ci// 6c5f01b2fSopenharmony_ci// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me> 7c5f01b2fSopenharmony_ci// SPDX-License-Identifier: MIT 8c5f01b2fSopenharmony_ci 9c5f01b2fSopenharmony_ci#include "doctest_compatibility.h" 10c5f01b2fSopenharmony_ci 11c5f01b2fSopenharmony_ci#include "config.hpp" 12c5f01b2fSopenharmony_ci 13c5f01b2fSopenharmony_ci#include <nlohmann/json_fwd.hpp> 14c5f01b2fSopenharmony_ci 15c5f01b2fSopenharmony_ciTEST_CASE("default namespace") 16c5f01b2fSopenharmony_ci{ 17c5f01b2fSopenharmony_ci // GCC 4.8 fails with regex_error 18c5f01b2fSopenharmony_ci#if !DOCTEST_GCC || DOCTEST_GCC >= DOCTEST_COMPILER(4, 9, 0) 19c5f01b2fSopenharmony_ci SECTION("namespace matches expectation") 20c5f01b2fSopenharmony_ci { 21c5f01b2fSopenharmony_ci std::string expected = "nlohmann::json_abi"; 22c5f01b2fSopenharmony_ci 23c5f01b2fSopenharmony_ci#if JSON_DIAGNOSTICS 24c5f01b2fSopenharmony_ci expected += "_diag"; 25c5f01b2fSopenharmony_ci#endif 26c5f01b2fSopenharmony_ci 27c5f01b2fSopenharmony_ci#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 28c5f01b2fSopenharmony_ci expected += "_ldvcmp"; 29c5f01b2fSopenharmony_ci#endif 30c5f01b2fSopenharmony_ci 31c5f01b2fSopenharmony_ci expected += "_v" STRINGIZE(NLOHMANN_JSON_VERSION_MAJOR); 32c5f01b2fSopenharmony_ci expected += "_" STRINGIZE(NLOHMANN_JSON_VERSION_MINOR); 33c5f01b2fSopenharmony_ci expected += "_" STRINGIZE(NLOHMANN_JSON_VERSION_PATCH) "::basic_json"; 34c5f01b2fSopenharmony_ci 35c5f01b2fSopenharmony_ci // fallback for Clang 36c5f01b2fSopenharmony_ci std::string ns{STRINGIZE(NLOHMANN_JSON_NAMESPACE) "::basic_json"}; 37c5f01b2fSopenharmony_ci 38c5f01b2fSopenharmony_ci CHECK(namespace_name<nlohmann::json>(ns) == expected); 39c5f01b2fSopenharmony_ci } 40c5f01b2fSopenharmony_ci#endif 41c5f01b2fSopenharmony_ci} 42