mirror of
https://github.com/nlohmann/json.git
synced 2026-03-11 11:41:27 +00:00
moved from Catch to doctest for unit tests
This commit is contained in:
@@ -27,10 +27,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "catch.hpp"
|
||||
#include "doctest_compatibility.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using nlohmann::json;
|
||||
|
||||
#include <array>
|
||||
@@ -236,7 +235,7 @@ void from_json(const nlohmann::json& j, contact_book& cb)
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("basic usage", "[udt]")
|
||||
TEST_CASE("basic usage" * doctest::test_suite("udt"))
|
||||
{
|
||||
|
||||
// a bit narcissic maybe :) ?
|
||||
@@ -392,7 +391,7 @@ struct adl_serializer<udt::legacy_type>
|
||||
};
|
||||
}
|
||||
|
||||
TEST_CASE("adl_serializer specialization", "[udt]")
|
||||
TEST_CASE("adl_serializer specialization" * doctest::test_suite("udt"))
|
||||
{
|
||||
SECTION("partial specialization")
|
||||
{
|
||||
@@ -468,7 +467,7 @@ struct adl_serializer<std::vector<float>>
|
||||
};
|
||||
}
|
||||
|
||||
TEST_CASE("even supported types can be specialized", "[udt]")
|
||||
TEST_CASE("even supported types can be specialized" * doctest::test_suite("udt"))
|
||||
{
|
||||
json j = std::vector<float> {1.0, 2.0, 3.0};
|
||||
CHECK(j.dump() == R"("hijacked!")");
|
||||
@@ -509,7 +508,7 @@ struct adl_serializer<std::unique_ptr<T>>
|
||||
};
|
||||
}
|
||||
|
||||
TEST_CASE("Non-copyable types", "[udt]")
|
||||
TEST_CASE("Non-copyable types" * doctest::test_suite("udt"))
|
||||
{
|
||||
SECTION("to_json")
|
||||
{
|
||||
@@ -651,7 +650,7 @@ std::ostream& operator<<(std::ostream& os, small_pod l)
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("custom serializer for pods", "[udt]")
|
||||
TEST_CASE("custom serializer for pods" * doctest::test_suite("udt"))
|
||||
{
|
||||
using custom_json =
|
||||
nlohmann::basic_json<std::map, std::vector, std::string, bool,
|
||||
@@ -692,7 +691,7 @@ struct another_adl_serializer
|
||||
}
|
||||
};
|
||||
|
||||
TEST_CASE("custom serializer that does adl by default", "[udt]")
|
||||
TEST_CASE("custom serializer that does adl by default" * doctest::test_suite("udt"))
|
||||
{
|
||||
using json = nlohmann::json;
|
||||
|
||||
@@ -798,7 +797,7 @@ template <typename T>
|
||||
struct is_constructible_patched<T, decltype(void(json(std::declval<T>())))> : std::true_type {};
|
||||
}
|
||||
|
||||
TEST_CASE("an incomplete type does not trigger a compiler error in non-evaluated context", "[udt]")
|
||||
TEST_CASE("an incomplete type does not trigger a compiler error in non-evaluated context" * doctest::test_suite("udt"))
|
||||
{
|
||||
static_assert(not is_constructible_patched<json, incomplete>::value, "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user