Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rust-mavlink
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
MAVLink
rust-mavlink
Commits
63a51d87
Commit
63a51d87
authored
1 year ago
by
Patrick José Pereira
Browse files
Options
Downloads
Patches
Plain Diff
tests: Add serialization test
Signed-off-by:
Patrick José Pereira
<
patrickelectric@gmail.com
>
parent
8c63f805
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/mav_frame_tests.rs
+5
-1
5 additions, 1 deletion
tests/mav_frame_tests.rs
with
5 additions
and
1 deletion
tests/mav_frame_tests.rs
+
5
−
1
View file @
63a51d87
...
...
@@ -23,7 +23,7 @@ mod mav_frame_tests {
];
#[test]
pub
fn
test_deser
()
{
pub
fn
test_deser
_ser
()
{
use
mavlink
::{
common
::
MavMessage
,
MavFrame
,
MavlinkVersion
};
let
frame
=
MavFrame
::
<
MavMessage
>
::
deser
(
MavlinkVersion
::
V2
,
HEARTBEAT_V2
)
.expect
(
"failed to parse message"
);
...
...
@@ -31,6 +31,10 @@ mod mav_frame_tests {
assert_eq!
(
frame
.header
,
crate
::
test_shared
::
COMMON_MSG_HEADER
);
let
heartbeat_msg
=
crate
::
test_shared
::
get_heartbeat_msg
();
let
mut
buffer
=
[
0u8
;
HEARTBEAT_V2
.len
()];
frame
.ser
(
&
mut
buffer
);
assert_eq!
(
buffer
[
..
buffer
.len
()
-
2
],
HEARTBEAT_V2
[
..
buffer
.len
()
-
2
]);
let
msg
=
match
frame
.msg
{
MavMessage
::
HEARTBEAT
(
msg
)
=>
msg
,
_
=>
panic!
(
"Decoded wrong message type"
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment