mirror of
https://github.com/nlohmann/json.git
synced 2026-03-05 08:46:29 +00:00
✅ improved test coverage
This commit is contained in:
@@ -31,6 +31,14 @@ SOFTWARE.
|
||||
#include "json.hpp"
|
||||
using nlohmann::json;
|
||||
|
||||
// helper function to check std::less<json::value_t>
|
||||
// see http://en.cppreference.com/w/cpp/utility/functional/less
|
||||
template <typename A, typename B, typename U = std::less<json::value_t>>
|
||||
bool f(A a, B b, U u = U())
|
||||
{
|
||||
return u(a, b);
|
||||
}
|
||||
|
||||
TEST_CASE("lexicographical comparison operators")
|
||||
{
|
||||
SECTION("types")
|
||||
@@ -69,6 +77,7 @@ TEST_CASE("lexicographical comparison operators")
|
||||
CAPTURE(j);
|
||||
// check precomputed values
|
||||
CHECK(operator<(j_types[i], j_types[j]) == expected[i][j]);
|
||||
CHECK(f(j_types[i], j_types[j]) == expected[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user