Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
e22cbacc
Unverified
Commit
e22cbacc
authored
Jul 26, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚨
fix warning
parent
67ed63b1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
12 deletions
+12
-12
test/CMakeLists.txt
test/CMakeLists.txt
+1
-1
test/src/test_utils.hpp
test/src/test_utils.hpp
+0
-0
test/src/unit-bson.cpp
test/src/unit-bson.cpp
+1
-1
test/src/unit-cbor.cpp
test/src/unit-cbor.cpp
+8
-8
test/src/unit-msgpack.cpp
test/src/unit-msgpack.cpp
+1
-1
test/src/unit-ubjson.cpp
test/src/unit-ubjson.cpp
+1
-1
No files found.
test/CMakeLists.txt
View file @
e22cbacc
...
...
@@ -151,7 +151,7 @@ foreach(file ${files})
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-deprecated;-Wno-float-equal>
$<$<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
}
)
if
(
JSON_Coverage
)
...
...
test/
utils
/test_utils.hpp
→
test/
src
/test_utils.hpp
View file @
e22cbacc
File moved
test/src/unit-bson.cpp
View file @
e22cbacc
...
...
@@ -35,7 +35,7 @@ using nlohmann::json;
#include <fstream>
#include <sstream>
#include <test_data.hpp>
#include
<test_utils.hpp>
#include
"test_utils.hpp"
TEST_CASE
(
"BSON"
)
{
...
...
test/src/unit-cbor.cpp
View file @
e22cbacc
...
...
@@ -39,7 +39,7 @@ using nlohmann::json;
#include <iostream>
#include <set>
#include <test_data.hpp>
#include
<test_utils.hpp>
#include
"test_utils.hpp"
namespace
{
...
...
@@ -2709,19 +2709,19 @@ TEST_CASE("Tagged values")
SECTION
(
"tagged binary"
)
{
// create a binary value of subtype 42
json
j
;
j
[
"binary"
]
=
json
::
binary
({
0xCA
,
0xFE
,
0xBA
,
0xBE
},
42
);
json
j
_binary
;
j
_binary
[
"binary"
]
=
json
::
binary
({
0xCA
,
0xFE
,
0xBA
,
0xBE
},
42
);
// convert to CBOR
const
auto
v
=
json
::
to_cbor
(
j
);
CHECK
(
v
==
std
::
vector
<
std
::
uint8_t
>
{
0xA1
,
0x66
,
0x62
,
0x69
,
0x6E
,
0x61
,
0x72
,
0x79
,
0xD8
,
0x2A
,
0x44
,
0xCA
,
0xFE
,
0xBA
,
0xBE
});
const
auto
v
ec
=
json
::
to_cbor
(
j_binary
);
CHECK
(
v
ec
==
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
CHECK_THROWS_AS
(
json
::
from_cbor
(
v
),
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_AS
(
json
::
from_cbor
(
v
ec
),
json
::
parse_error
);
CHECK_THROWS_WITH
(
json
::
from_cbor
(
v
ec
),
"[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
json
jb
=
json
::
from_cbor
(
v
,
true
,
true
,
json
::
cbor_tag_handler_t
::
ignore
);
json
jb
=
json
::
from_cbor
(
v
ec
,
true
,
true
,
json
::
cbor_tag_handler_t
::
ignore
);
CHECK
(
jb
.
is_object
());
CHECK
(
jb
[
"binary"
].
is_binary
());
CHECK
(
!
jb
[
"binary"
].
get_binary
().
has_subtype
());
...
...
test/src/unit-msgpack.cpp
View file @
e22cbacc
...
...
@@ -37,7 +37,7 @@ using nlohmann::json;
#include <iomanip>
#include <set>
#include <test_data.hpp>
#include
<test_utils.hpp>
#include
"test_utils.hpp"
namespace
{
...
...
test/src/unit-ubjson.cpp
View file @
e22cbacc
...
...
@@ -36,7 +36,7 @@ using nlohmann::json;
#include <fstream>
#include <set>
#include <test_data.hpp>
#include
<test_utils.hpp>
#include
"test_utils.hpp"
namespace
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment