2022-07-31 13:22:22 +08:00
|
|
|
// __ _____ _____ _____
|
|
|
|
// __| | __| | | | JSON for Modern C++ (supporting code)
|
2022-08-12 21:04:06 +08:00
|
|
|
// | | |__ | | | | | | version 3.11.2
|
2022-07-31 13:22:22 +08:00
|
|
|
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
|
|
|
|
//
|
2023-11-26 22:51:19 +08:00
|
|
|
// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
|
2022-07-31 13:22:22 +08:00
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2022-07-31 03:59:13 +08:00
|
|
|
#include "doctest_compatibility.h"
|
|
|
|
|
|
|
|
#include "diag.hpp"
|
|
|
|
|
|
|
|
TEST_CASE("ABI compatible diagnostics")
|
|
|
|
{
|
|
|
|
SECTION("basic_json size")
|
|
|
|
{
|
|
|
|
// basic_json with diagnostics is larger because of added data members
|
|
|
|
CHECK(json_sizeof_diag_on() == json_sizeof_diag_on_explicit());
|
|
|
|
CHECK(json_sizeof_diag_off() == json_sizeof_diag_off_explicit());
|
|
|
|
CHECK(json_sizeof_diag_on() > json_sizeof_diag_off());
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("basic_json at")
|
|
|
|
{
|
|
|
|
// accessing a nonexistent key throws different exception with diagnostics
|
|
|
|
CHECK_THROWS_WITH(json_at_diag_on(), "[json.exception.out_of_range.403] (/foo) key 'bar' not found");
|
|
|
|
CHECK_THROWS_WITH(json_at_diag_off(), "[json.exception.out_of_range.403] key 'bar' not found");
|
|
|
|
}
|
|
|
|
}
|