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// define custom namespace 14c5f01b2fSopenharmony_ci#define NLOHMANN_JSON_NAMESPACE nlohmann // this line may be omitted 15c5f01b2fSopenharmony_ci#define NLOHMANN_JSON_NAMESPACE_BEGIN namespace nlohmann { 16c5f01b2fSopenharmony_ci#define NLOHMANN_JSON_NAMESPACE_END } 17c5f01b2fSopenharmony_ci#include <nlohmann/json_fwd.hpp> 18c5f01b2fSopenharmony_ci 19c5f01b2fSopenharmony_ciTEST_CASE("custom namespace") 20c5f01b2fSopenharmony_ci{ 21c5f01b2fSopenharmony_ci // GCC 4.8 fails with regex_error 22c5f01b2fSopenharmony_ci#if !DOCTEST_GCC || DOCTEST_GCC >= DOCTEST_COMPILER(4, 9, 0) 23c5f01b2fSopenharmony_ci SECTION("namespace matches expectation") 24c5f01b2fSopenharmony_ci { 25c5f01b2fSopenharmony_ci std::string expected = "nlohmann::basic_json"; 26c5f01b2fSopenharmony_ci 27c5f01b2fSopenharmony_ci // fallback for Clang 28c5f01b2fSopenharmony_ci std::string ns{STRINGIZE(NLOHMANN_JSON_NAMESPACE) "::basic_json"}; 29c5f01b2fSopenharmony_ci 30c5f01b2fSopenharmony_ci CHECK(namespace_name<nlohmann::json>(ns) == expected); 31c5f01b2fSopenharmony_ci } 32c5f01b2fSopenharmony_ci#endif 33c5f01b2fSopenharmony_ci} 34