Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
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
cpp-libs
Actor Framework
Commits
74034160
Commit
74034160
authored
Jan 20, 2021
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add additional test case for the JSON reader
parent
83a76307
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
libcaf_core/test/json_reader.cpp
libcaf_core/test/json_reader.cpp
+33
-0
No files found.
libcaf_core/test/json_reader.cpp
View file @
74034160
...
...
@@ -58,6 +58,36 @@ struct fixture {
std
::
vector
<
std
::
function
<
bool
()
>>
test_cases
;
};
struct
point
{
int
x
;
int
y
;
};
bool
operator
==
(
point
a
,
point
b
)
noexcept
{
return
std
::
tie
(
a
.
x
,
a
.
y
)
==
std
::
tie
(
b
.
x
,
b
.
y
);
}
template
<
class
Inspector
>
bool
inspect
(
Inspector
&
f
,
point
&
x
)
{
return
f
.
object
(
x
).
fields
(
f
.
field
(
"x"
,
x
.
x
),
f
.
field
(
"y"
,
x
.
y
));
}
struct
rectangle
{
point
top_left
;
point
bottom_right
;
};
template
<
class
Inspector
>
bool
inspect
(
Inspector
&
f
,
rectangle
&
x
)
{
return
f
.
object
(
x
).
fields
(
f
.
field
(
"top-left"
,
x
.
top_left
),
f
.
field
(
"bottom-right"
,
x
.
bottom_right
));
}
bool
operator
==
(
const
rectangle
&
x
,
const
rectangle
&
y
)
noexcept
{
return
std
::
tie
(
x
.
top_left
,
x
.
bottom_right
)
==
std
::
tie
(
y
.
top_left
,
y
.
bottom_right
);
}
fixture
::
fixture
()
{
using
i32_list
=
std
::
vector
<
int32_t
>
;
using
str_list
=
std
::
vector
<
std
::
string
>
;
...
...
@@ -84,6 +114,9 @@ fixture::fixture() {
{
"ys"
,
set
<
std
::
string
>
(
"y1"
,
"y2"
)}}));
add_test_case
(
R"_([{"@type": "my_request", "a": 1, "b": 2}])_"
,
make_message
(
my_request
(
1
,
2
)));
add_test_case
(
R"_({"top-left":{"x":100,"y":200},"bottom-right":{"x":10,"y":20}})_"
,
rectangle
{{
100
,
200
},
{
10
,
20
}});
}
}
// 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