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 #include <nlohmann/json_fwd.hpp> 14 15 TEST_CASE("default namespace") 16 { 17 // GCC 4.8 fails with regex_error 18 #if !DOCTEST_GCC || DOCTEST_GCC >= DOCTEST_COMPILER(4, 9, 0) 19 SECTION("namespace matches expectation") 20 { 21 std::string expected = "nlohmann::json_abi"; 22 23 #if JSON_DIAGNOSTICS 24 expected += "_diag"; 25 #endif 26 27 #if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 28 expected += "_ldvcmp"; 29 #endif 30 31 expected += "_v" STRINGIZE(NLOHMANN_JSON_VERSION_MAJOR); 32 expected += "_" STRINGIZE(NLOHMANN_JSON_VERSION_MINOR); 33 expected += "_" STRINGIZE(NLOHMANN_JSON_VERSION_PATCH) "::basic_json"; 34 35 // fallback for Clang 36 std::string ns{STRINGIZE(NLOHMANN_JSON_NAMESPACE) "::basic_json"}; 37 38 CHECK(namespace_name<nlohmann::json>(ns) == expected); 39 } 40 #endif 41 } 42