diff options
Diffstat (limited to 'json4cpp/tests/src/unit-iterators3.cpp')
| -rw-r--r-- | json4cpp/tests/src/unit-iterators3.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/json4cpp/tests/src/unit-iterators3.cpp b/json4cpp/tests/src/unit-iterators3.cpp new file mode 100644 index 0000000000..f9b86ade39 --- /dev/null +++ b/json4cpp/tests/src/unit-iterators3.cpp @@ -0,0 +1,35 @@ +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ (supporting code) +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann <https://nlohmann.me> +// SPDX-License-Identifier: MIT + +#include "doctest_compatibility.h" + +#include <string> +#include <unordered_map> +#include <vector> + +#include <nlohmann/json.hpp> +using nlohmann::json; + +#if (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) + #define JSON_HAS_CPP_14 +#endif + +#ifdef JSON_HAS_CPP_14 +TEST_CASE_TEMPLATE("checking forward-iterators", T, // NOLINT(readability-math-missing-parentheses, bugprone-throwing-static-initialization) + std::vector<int>, std::string, nlohmann::json) +{ + auto it1 = typename T::iterator{}; + auto it2 = typename T::iterator{}; + CHECK(it1 == it2); + CHECK(it1 <= it2); + CHECK(it1 >= it2); + CHECK_FALSE(it1 != it2); + CHECK_FALSE(it1 < it2); + CHECK_FALSE(it1 > it2); +} +#endif |
