Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
ECSS Services
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
AcubeSat-OBC
ECSS Services
Commits
e7533511
Commit
e7533511
authored
4 years ago
by
Sedictious
Browse files
Options
Downloads
Patches
Plain Diff
Use validateCRC in tests
parent
ec5883d0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/MessageParser.cpp
+7
-7
7 additions, 7 deletions
test/MessageParser.cpp
with
7 additions
and
7 deletions
test/MessageParser.cpp
+
7
−
7
View file @
e7533511
...
...
@@ -40,9 +40,10 @@ TEST_CASE("TC Message parsing into a string", "[MessageParser]") {
CHECK
(
createdPacket
.
size
()
==
18
);
CHECK
(
memcmp
(
createdPacket
.
data
(),
wantedPacket
,
16
)
==
0
);
uint16_t
crcField
=
CRCHelper
::
calculateCRC
(
wantedPacket
,
16
);
uint16_t
calculatedCRC
=
(
static_cast
<
uint16_t
>
(
createdPacket
.
data
()[
16
])
<<
0x8U
)
|
(
static_cast
<
uint16_t
>
(
createdPacket
.
data
()[
17
])
&
0xFF
);
CHECK
(
calculatedCRC
==
crcField
);
createdPacket
.
data
();
const
uint8_t
*
packet
=
reinterpret_cast
<
uint8_t
*>
(
&
createdPacket
.
data
()[
0
]);
uint8_t
crc_verification
=
CRCHelper
::
validateCRC
(
packet
,
18
);
CHECK
(
crc_verification
==
0
);
#else
CHECK
(
createdPacket
.
size
()
==
16
);
// The two parentheses are necessary so that Catch2 doesn't try to parse the strings here
...
...
@@ -82,10 +83,9 @@ TEST_CASE("TM Message parsing into a string", "[MessageParser]") {
CHECK
(
createdPacket
.
size
()
==
20
);
CHECK
(
memcmp
(
createdPacket
.
data
(),
wantedPacket
,
18
)
==
0
);
uint16_t
crcField
=
CRCHelper
::
calculateCRC
(
wantedPacket
,
18
);
uint16_t
calculatedCRC
=
(
static_cast
<
uint16_t
>
(
createdPacket
.
data
()[
18
])
<<
0x8U
)
|
(
static_cast
<
uint16_t
>
(
createdPacket
.
data
()[
19
])
&
0xFFU
);
CHECK
(
calculatedCRC
==
crcField
);
const
uint8_t
*
packet
=
reinterpret_cast
<
uint8_t
*>
(
&
createdPacket
.
data
()[
0
]);
uint8_t
crc_verification
=
CRCHelper
::
validateCRC
(
packet
,
20
);
CHECK
(
crc_verification
==
0
);
#else
CHECK
(
createdPacket
.
size
()
==
18
);
// The two parentheses are necessary so that Catch2 doesn't try to parse the strings here
...
...
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