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
3fa94f07
Unverified
Commit
3fa94f07
authored
May 09, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✅
add tests for binary type
parent
f0c6ab4d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
+39
-0
test/src/unit-constructor1.cpp
test/src/unit-constructor1.cpp
+8
-0
test/src/unit-constructor2.cpp
test/src/unit-constructor2.cpp
+15
-0
test/src/unit-element_access1.cpp
test/src/unit-element_access1.cpp
+16
-0
No files found.
test/src/unit-constructor1.cpp
View file @
3fa94f07
...
...
@@ -115,6 +115,14 @@ TEST_CASE("constructors")
CHECK
(
j
.
type
()
==
t
);
CHECK
(
j
==
0.0
);
}
SECTION
(
"binary"
)
{
auto
t
=
json
::
value_t
::
binary
;
json
j
(
t
);
CHECK
(
j
.
type
()
==
t
);
CHECK
(
j
==
json
::
binary_array
({}));
}
}
SECTION
(
"create a null object (implicitly)"
)
...
...
test/src/unit-constructor2.cpp
View file @
3fa94f07
...
...
@@ -91,6 +91,13 @@ TEST_CASE("other constructors and destructor")
json
k
(
j
);
CHECK
(
j
==
k
);
}
SECTION
(
"binary"
)
{
json
j
=
json
::
binary_array
({
1
,
2
,
3
});
json
k
(
j
);
CHECK
(
j
==
k
);
}
}
SECTION
(
"move constructor"
)
...
...
@@ -167,6 +174,14 @@ TEST_CASE("other constructors and destructor")
k
=
j
;
CHECK
(
j
==
k
);
}
SECTION
(
"binary"
)
{
json
j
=
json
::
binary_array
({
1
,
2
,
3
});
json
k
;
k
=
j
;
CHECK
(
j
==
k
);
}
}
SECTION
(
"destructor"
)
...
...
test/src/unit-element_access1.cpp
View file @
3fa94f07
...
...
@@ -694,6 +694,22 @@ TEST_CASE("element access 1")
CHECK
(
it
==
j
.
end
());
}
}
SECTION
(
"binary"
)
{
{
json
j
=
json
::
binary_array
({
1
,
2
,
3
});
json
::
iterator
it
=
j
.
erase
(
j
.
begin
());
CHECK
(
j
.
type
()
==
json
::
value_t
::
null
);
CHECK
(
it
==
j
.
end
());
}
{
json
j
=
json
::
binary_array
({
1
,
2
,
3
});
json
::
const_iterator
it
=
j
.
erase
(
j
.
cbegin
());
CHECK
(
j
.
type
()
==
json
::
value_t
::
null
);
CHECK
(
it
==
j
.
end
());
}
}
}
SECTION
(
"erase with one invalid iterator"
)
...
...
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