Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
pinocchio
Commits
6e9c4c59
Verified
Commit
6e9c4c59
authored
Apr 18, 2021
by
Justin Carpentier
Browse files
test: add testing of StaticBuffer
parent
8acaf116
Changes
1
Show whitespace changes
Inline
Side-by-side
unittest/serialization.cpp
View file @
6e9c4c59
...
...
@@ -140,6 +140,34 @@ void generic_test(const T & object,
// Check
BOOST_CHECK
(
run_call_equality_op
(
object_loaded
,
object
));
}
// Load and save as static binary stream
pinocchio
::
serialization
::
StaticBuffer
static_buffer
(
10000000
);
saveToBinary
(
object
,
static_buffer
);
{
T
object_loaded
;
loadFromBinary
(
object_loaded
,
static_buffer
);
// Check
BOOST_CHECK
(
run_call_equality_op
(
object_loaded
,
object
));
}
}
BOOST_AUTO_TEST_CASE
(
test_static_buffer
)
{
using
namespace
pinocchio
::
serialization
;
const
size_t
size
=
10000000
;
StaticBuffer
static_buffer
(
size
);
BOOST_CHECK
(
size
==
static_buffer
.
size
());
const
size_t
new_size
=
2
*
size
;
static_buffer
.
resize
(
new_size
);
BOOST_CHECK
(
new_size
==
static_buffer
.
size
());
BOOST_CHECK
(
static_buffer
.
data
()
!=
NULL
);
BOOST_CHECK
(
reinterpret_cast
<
const
StaticBuffer
&>
(
static_buffer
).
data
()
!=
NULL
);
BOOST_CHECK
(
reinterpret_cast
<
const
StaticBuffer
&>
(
static_buffer
).
data
()
==
static_buffer
.
data
());
}
BOOST_AUTO_TEST_CASE
(
test_eigen_serialization
)
...
...
Write
Preview
Supports
Markdown
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