🚨 fix warning
This commit is contained in:
parent
67ed63b196
commit
e22cbacc41
6 changed files with 12 additions and 12 deletions
|
@ -151,7 +151,7 @@ foreach(file ${files})
|
||||||
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-deprecated;-Wno-float-equal>
|
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-deprecated;-Wno-float-equal>
|
||||||
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
|
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
|
||||||
)
|
)
|
||||||
target_include_directories(${testcase} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/utils ${CMAKE_BINARY_DIR}/include thirdparty/doctest thirdparty/fifo_map)
|
target_include_directories(${testcase} PRIVATE ${CMAKE_BINARY_DIR}/include thirdparty/doctest thirdparty/fifo_map)
|
||||||
target_link_libraries(${testcase} PRIVATE ${NLOHMANN_JSON_TARGET_NAME})
|
target_link_libraries(${testcase} PRIVATE ${NLOHMANN_JSON_TARGET_NAME})
|
||||||
|
|
||||||
if (JSON_Coverage)
|
if (JSON_Coverage)
|
||||||
|
|
|
@ -35,7 +35,7 @@ using nlohmann::json;
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <test_data.hpp>
|
#include <test_data.hpp>
|
||||||
#include <test_utils.hpp>
|
#include "test_utils.hpp"
|
||||||
|
|
||||||
TEST_CASE("BSON")
|
TEST_CASE("BSON")
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ using nlohmann::json;
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <test_data.hpp>
|
#include <test_data.hpp>
|
||||||
#include <test_utils.hpp>
|
#include "test_utils.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -2709,19 +2709,19 @@ TEST_CASE("Tagged values")
|
||||||
SECTION("tagged binary")
|
SECTION("tagged binary")
|
||||||
{
|
{
|
||||||
// create a binary value of subtype 42
|
// create a binary value of subtype 42
|
||||||
json j;
|
json j_binary;
|
||||||
j["binary"] = json::binary({0xCA, 0xFE, 0xBA, 0xBE}, 42);
|
j_binary["binary"] = json::binary({0xCA, 0xFE, 0xBA, 0xBE}, 42);
|
||||||
|
|
||||||
// convert to CBOR
|
// convert to CBOR
|
||||||
const auto v = json::to_cbor(j);
|
const auto vec = json::to_cbor(j_binary);
|
||||||
CHECK(v == std::vector<std::uint8_t> {0xA1, 0x66, 0x62, 0x69, 0x6E, 0x61, 0x72, 0x79, 0xD8, 0x2A, 0x44, 0xCA, 0xFE, 0xBA, 0xBE});
|
CHECK(vec == std::vector<std::uint8_t> {0xA1, 0x66, 0x62, 0x69, 0x6E, 0x61, 0x72, 0x79, 0xD8, 0x2A, 0x44, 0xCA, 0xFE, 0xBA, 0xBE});
|
||||||
|
|
||||||
// parse error when parsing tagged value
|
// parse error when parsing tagged value
|
||||||
CHECK_THROWS_AS(json::from_cbor(v), json::parse_error);
|
CHECK_THROWS_AS(json::from_cbor(vec), json::parse_error);
|
||||||
CHECK_THROWS_WITH(json::from_cbor(v), "[json.exception.parse_error.112] parse error at byte 9: syntax error while parsing CBOR value: invalid byte: 0xD8");
|
CHECK_THROWS_WITH(json::from_cbor(vec), "[json.exception.parse_error.112] parse error at byte 9: syntax error while parsing CBOR value: invalid byte: 0xD8");
|
||||||
|
|
||||||
// binary without subtype when tags are ignored
|
// binary without subtype when tags are ignored
|
||||||
json jb = json::from_cbor(v, true, true, json::cbor_tag_handler_t::ignore);
|
json jb = json::from_cbor(vec, true, true, json::cbor_tag_handler_t::ignore);
|
||||||
CHECK(jb.is_object());
|
CHECK(jb.is_object());
|
||||||
CHECK(jb["binary"].is_binary());
|
CHECK(jb["binary"].is_binary());
|
||||||
CHECK(!jb["binary"].get_binary().has_subtype());
|
CHECK(!jb["binary"].get_binary().has_subtype());
|
||||||
|
|
|
@ -37,7 +37,7 @@ using nlohmann::json;
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <test_data.hpp>
|
#include <test_data.hpp>
|
||||||
#include <test_utils.hpp>
|
#include "test_utils.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,7 @@ using nlohmann::json;
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <test_data.hpp>
|
#include <test_data.hpp>
|
||||||
#include <test_utils.hpp>
|
#include "test_utils.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue