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
0bcb5c9d
Commit
0bcb5c9d
authored
Mar 19, 2017
by
Matthias Vallentin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add serialization test for 64-bit values
parent
6ff2858e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
libcaf_core/test/serialization.cpp
libcaf_core/test/serialization.cpp
+12
-4
No files found.
libcaf_core/test/serialization.cpp
View file @
0bcb5c9d
...
@@ -139,6 +139,7 @@ public:
...
@@ -139,6 +139,7 @@ public:
struct
fixture
{
struct
fixture
{
int32_t
i32
=
-
345
;
int32_t
i32
=
-
345
;
int64_t
i64
=
-
1234567890123456789ll
;
float
f32
=
3.45
f
;
float
f32
=
3.45
f
;
double
f64
=
54.3
;
double
f64
=
54.3
;
duration
dur
=
duration
{
time_unit
::
seconds
,
123
};
duration
dur
=
duration
{
time_unit
::
seconds
,
123
};
...
@@ -197,7 +198,7 @@ struct fixture {
...
@@ -197,7 +198,7 @@ struct fixture {
:
system
(
cfg
),
:
system
(
cfg
),
context
(
&
system
)
{
context
(
&
system
)
{
rs
.
str
.
assign
(
string
(
str
.
rbegin
(),
str
.
rend
()));
rs
.
str
.
assign
(
string
(
str
.
rbegin
(),
str
.
rend
()));
msg
=
make_message
(
i32
,
dur
,
ts
,
te
,
str
,
rs
);
msg
=
make_message
(
i32
,
i64
,
dur
,
ts
,
te
,
str
,
rs
);
}
}
};
};
...
@@ -249,6 +250,13 @@ CAF_TEST(i32_values) {
...
@@ -249,6 +250,13 @@ CAF_TEST(i32_values) {
CAF_CHECK_EQUAL
(
i32
,
x
);
CAF_CHECK_EQUAL
(
i32
,
x
);
}
}
CAF_TEST
(
i64_values
)
{
auto
buf
=
serialize
(
i64
);
int64_t
x
;
deserialize
(
buf
,
x
);
CAF_CHECK_EQUAL
(
i64
,
x
);
}
CAF_TEST
(
float_values
)
{
CAF_TEST
(
float_values
)
{
auto
buf
=
serialize
(
f32
);
auto
buf
=
serialize
(
f32
);
float
x
;
float
x
;
...
@@ -352,14 +360,14 @@ CAF_TEST(messages) {
...
@@ -352,14 +360,14 @@ CAF_TEST(messages) {
auto
buf1
=
serialize
(
msg
);
auto
buf1
=
serialize
(
msg
);
deserialize
(
buf1
,
x
);
deserialize
(
buf1
,
x
);
CAF_CHECK_EQUAL
(
to_string
(
msg
),
to_string
(
x
));
CAF_CHECK_EQUAL
(
to_string
(
msg
),
to_string
(
x
));
CAF_CHECK
(
is_message
(
x
).
equal
(
i32
,
dur
,
ts
,
te
,
str
,
rs
));
CAF_CHECK
(
is_message
(
x
).
equal
(
i32
,
i64
,
dur
,
ts
,
te
,
str
,
rs
));
// serialize fully dynamic message again (do another roundtrip)
// serialize fully dynamic message again (do another roundtrip)
message
y
;
message
y
;
auto
buf2
=
serialize
(
x
);
auto
buf2
=
serialize
(
x
);
CAF_CHECK_EQUAL
(
buf1
,
buf2
);
CAF_CHECK_EQUAL
(
buf1
,
buf2
);
deserialize
(
buf2
,
y
);
deserialize
(
buf2
,
y
);
CAF_CHECK_EQUAL
(
to_string
(
msg
),
to_string
(
y
));
CAF_CHECK_EQUAL
(
to_string
(
msg
),
to_string
(
y
));
CAF_CHECK
(
is_message
(
y
).
equal
(
i32
,
dur
,
ts
,
te
,
str
,
rs
));
CAF_CHECK
(
is_message
(
y
).
equal
(
i32
,
i64
,
dur
,
ts
,
te
,
str
,
rs
));
}
}
CAF_TEST
(
multiple_messages
)
{
CAF_TEST
(
multiple_messages
)
{
...
@@ -372,7 +380,7 @@ CAF_TEST(multiple_messages) {
...
@@ -372,7 +380,7 @@ CAF_TEST(multiple_messages) {
CAF_CHECK_EQUAL
(
std
::
make_tuple
(
t
,
to_string
(
m1
),
to_string
(
m2
)),
CAF_CHECK_EQUAL
(
std
::
make_tuple
(
t
,
to_string
(
m1
),
to_string
(
m2
)),
std
::
make_tuple
(
te
,
to_string
(
m
),
to_string
(
msg
)));
std
::
make_tuple
(
te
,
to_string
(
m
),
to_string
(
msg
)));
CAF_CHECK
(
is_message
(
m1
).
equal
(
rs
,
te
));
CAF_CHECK
(
is_message
(
m1
).
equal
(
rs
,
te
));
CAF_CHECK
(
is_message
(
m2
).
equal
(
i32
,
dur
,
ts
,
te
,
str
,
rs
));
CAF_CHECK
(
is_message
(
m2
).
equal
(
i32
,
i64
,
dur
,
ts
,
te
,
str
,
rs
));
}
}
...
...
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