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