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
c8857865
Unverified
Commit
c8857865
authored
6 years ago
by
Dimitrios Stoupis
Browse files
Options
Downloads
Patches
Plain Diff
Fix tests
parent
cdf4373e
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/Services/MemoryManagementService.cpp
+18
-9
18 additions, 9 deletions
test/Services/MemoryManagementService.cpp
with
18 additions
and
9 deletions
test/Services/MemoryManagementService.cpp
+
18
−
9
View file @
c8857865
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#include
<Services/MemoryManagementService.hpp>
#include
<Services/MemoryManagementService.hpp>
#include
<Message.hpp>
#include
<Message.hpp>
#include
"ServiceTests.hpp"
#include
"ServiceTests.hpp"
#include
"Helpers/CRCHelper.hpp"
TEST_CASE
(
"TM[6,2]"
,
"[service][st06]"
)
{
TEST_CASE
(
"TM[6,2]"
,
"[service][st06]"
)
{
// Required test variables
// Required test variables
...
@@ -18,8 +19,10 @@ TEST_CASE("TM[6,2]", "[service][st06]") {
...
@@ -18,8 +19,10 @@ TEST_CASE("TM[6,2]", "[service][st06]") {
receivedPacket
.
appendUint16
(
2
);
// Iteration count
receivedPacket
.
appendUint16
(
2
);
// Iteration count
receivedPacket
.
appendUint64
(
reinterpret_cast
<
uint64_t
>
(
pStr
));
// Start address
receivedPacket
.
appendUint64
(
reinterpret_cast
<
uint64_t
>
(
pStr
));
// Start address
receivedPacket
.
appendOctetString
(
2
,
data
);
receivedPacket
.
appendOctetString
(
2
,
data
);
receivedPacket
.
appendBits
(
16
,
CRCHelper
::
calculateCRC
(
data
,
2
));
// Append CRC
receivedPacket
.
appendUint64
(
reinterpret_cast
<
uint64_t
>
(
pStr
+
2
));
// Start address
receivedPacket
.
appendUint64
(
reinterpret_cast
<
uint64_t
>
(
pStr
+
2
));
// Start address
receivedPacket
.
appendOctetString
(
1
,
data
);
receivedPacket
.
appendOctetString
(
1
,
data
);
// Append CRC
receivedPacket
.
appendBits
(
16
,
CRCHelper
::
calculateCRC
(
data
,
1
));
memMangService
.
rawDataMemorySubservice
.
loadRawData
(
receivedPacket
);
memMangService
.
rawDataMemorySubservice
.
loadRawData
(
receivedPacket
);
CHECK
(
pStr
[
0
]
==
'h'
);
CHECK
(
pStr
[
0
]
==
'h'
);
...
@@ -33,43 +36,46 @@ TEST_CASE("TM[6,5]", "[service][st06]") {
...
@@ -33,43 +36,46 @@ TEST_CASE("TM[6,5]", "[service][st06]") {
uint8_t
testString_3
[
2
]
=
{
5
,
8
};
uint8_t
testString_3
[
2
]
=
{
5
,
8
};
uint8_t
checkString
[
ECSS_MAX_STRING_SIZE
];
uint8_t
checkString
[
ECSS_MAX_STRING_SIZE
];
uint16_t
readSize
=
0
;
uint16_t
readSize
=
0
,
checksum
=
0
;
MemoryManagementService
memMangService
;
MemoryManagementService
memMangService
;
Message
receivedPacket
=
Message
(
6
,
5
,
Message
::
TC
,
1
);
Message
receivedPacket
=
Message
(
6
,
5
,
Message
::
TC
,
1
);
receivedPacket
.
appendEnum8
(
MemoryManagementService
::
MemoryID
::
EXTERNAL
);
// Memory ID
receivedPacket
.
appendEnum8
(
MemoryManagementService
::
MemoryID
::
EXTERNAL
);
// Memory ID
receivedPacket
.
appendUint16
(
3
);
// Iteration count (Equal to 3 test strings)
receivedPacket
.
appendUint16
(
3
);
// Iteration count (Equal to 3 test strings)
receivedPacket
.
appendUint64
(
reinterpret_cast
<
uint64_t
>
(
testString_1
));
// Start address
receivedPacket
.
appendUint64
(
reinterpret_cast
<
uint64_t
>
(
testString_1
));
// Start address
receivedPacket
.
appendUint16
(
sizeof
(
testString_1
)
/
sizeof
(
testString_1
[
0
]));
// Data read length
receivedPacket
.
appendUint16
(
sizeof
(
testString_1
)
/
sizeof
(
testString_1
[
0
]));
// Data read length
receivedPacket
.
appendUint64
(
reinterpret_cast
<
uint64_t
>
(
testString_2
));
receivedPacket
.
appendUint64
(
reinterpret_cast
<
uint64_t
>
(
testString_2
));
receivedPacket
.
appendUint16
(
sizeof
(
testString_2
)
/
sizeof
(
testString_2
[
0
]));
receivedPacket
.
appendUint16
(
sizeof
(
testString_2
)
/
sizeof
(
testString_2
[
0
]));
receivedPacket
.
appendUint64
(
reinterpret_cast
<
uint64_t
>
(
testString_3
));
receivedPacket
.
appendUint64
(
reinterpret_cast
<
uint64_t
>
(
testString_3
));
receivedPacket
.
appendUint16
(
sizeof
(
testString_3
)
/
sizeof
(
testString_3
[
0
]));
receivedPacket
.
appendUint16
(
sizeof
(
testString_3
)
/
sizeof
(
testString_3
[
0
]));
memMangService
.
rawDataMemorySubservice
.
dumpRawData
(
receivedPacket
);
memMangService
.
rawDataMemorySubservice
.
dumpRawData
(
receivedPacket
);
REQUIRE
(
ServiceTests
::
hasOneMessage
());
REQUIRE
(
ServiceTests
::
hasOneMessage
());
Message
response
=
ServiceTests
::
get
(
0
);
Message
response
=
ServiceTests
::
get
(
0
);
CHECK
(
response
.
serviceType
==
6
);
CHECK
(
response
.
serviceType
==
6
);
CHECK
(
response
.
messageType
==
6
);
CHECK
(
response
.
messageType
==
6
);
REQUIRE
(
response
.
dataSize
==
49
);
REQUIRE
(
response
.
dataSize
==
55
);
CHECK
(
response
.
readEnum8
()
==
MemoryManagementService
::
MemoryID
::
EXTERNAL
);
CHECK
(
response
.
readEnum8
()
==
MemoryManagementService
::
MemoryID
::
EXTERNAL
);
CHECK
(
response
.
readUint16
()
==
3
);
CHECK
(
response
.
readUint16
()
==
3
);
CHECK
(
response
.
readUint64
()
==
reinterpret_cast
<
uint64_t
>
(
testString_1
));
CHECK
(
response
.
readUint64
()
==
reinterpret_cast
<
uint64_t
>
(
testString_1
));
readSize
=
response
.
readOctetString
(
checkString
);
readSize
=
response
.
readOctetString
(
checkString
);
CHECK
(
readSize
==
sizeof
(
testString_1
)
/
sizeof
(
testString_1
[
0
]));
checksum
=
response
.
readBits
(
16
);
CHECK
(
readSize
==
sizeof
(
testString_1
)
/
sizeof
(
testString_1
[
0
]));
CHECK
(
checkString
[
0
]
==
'F'
);
CHECK
(
checkString
[
0
]
==
'F'
);
CHECK
(
checkString
[
1
]
==
'S'
);
CHECK
(
checkString
[
1
]
==
'S'
);
CHECK
(
checkString
[
2
]
==
't'
);
CHECK
(
checkString
[
2
]
==
't'
);
CHECK
(
checkString
[
3
]
==
'r'
);
CHECK
(
checkString
[
3
]
==
'r'
);
CHECK
(
checkString
[
4
]
==
'T'
);
CHECK
(
checkString
[
4
]
==
'T'
);
CHECK
(
checkString
[
5
]
==
'\0'
);
CHECK
(
checkString
[
5
]
==
'\0'
);
CHECK
(
checksum
==
CRCHelper
::
calculateCRC
(
checkString
,
readSize
));
CHECK
(
response
.
readUint64
()
==
reinterpret_cast
<
uint64_t
>
(
testString_2
));
CHECK
(
response
.
readUint64
()
==
reinterpret_cast
<
uint64_t
>
(
testString_2
));
readSize
=
response
.
readOctetString
(
checkString
);
readSize
=
response
.
readOctetString
(
checkString
);
CHECK
(
readSize
==
sizeof
(
testString_2
)
/
sizeof
(
testString_2
[
0
]));
checksum
=
response
.
readBits
(
16
);
CHECK
(
readSize
==
sizeof
(
testString_2
)
/
sizeof
(
testString_2
[
0
]));
CHECK
(
checkString
[
0
]
==
'S'
);
CHECK
(
checkString
[
0
]
==
'S'
);
CHECK
(
checkString
[
1
]
==
'e'
);
CHECK
(
checkString
[
1
]
==
'e'
);
CHECK
(
checkString
[
2
]
==
'c'
);
CHECK
(
checkString
[
2
]
==
'c'
);
...
@@ -78,10 +84,13 @@ TEST_CASE("TM[6,5]", "[service][st06]") {
...
@@ -78,10 +84,13 @@ TEST_CASE("TM[6,5]", "[service][st06]") {
CHECK
(
checkString
[
5
]
==
'r'
);
CHECK
(
checkString
[
5
]
==
'r'
);
CHECK
(
checkString
[
6
]
==
'T'
);
CHECK
(
checkString
[
6
]
==
'T'
);
CHECK
(
checkString
[
7
]
==
'\0'
);
CHECK
(
checkString
[
7
]
==
'\0'
);
CHECK
(
checksum
==
CRCHelper
::
calculateCRC
(
checkString
,
readSize
));
CHECK
(
response
.
readUint64
()
==
reinterpret_cast
<
uint64_t
>
(
testString_3
));
CHECK
(
response
.
readUint64
()
==
reinterpret_cast
<
uint64_t
>
(
testString_3
));
readSize
=
response
.
readOctetString
(
checkString
);
readSize
=
response
.
readOctetString
(
checkString
);
CHECK
(
readSize
==
sizeof
(
testString_3
)
/
sizeof
(
testString_3
[
0
]));
checksum
=
response
.
readBits
(
16
);
CHECK
(
readSize
==
sizeof
(
testString_3
)
/
sizeof
(
testString_3
[
0
]));
CHECK
(
checkString
[
0
]
==
5
);
CHECK
(
checkString
[
0
]
==
5
);
CHECK
(
checkString
[
1
]
==
8
);
CHECK
(
checkString
[
1
]
==
8
);
CHECK
(
checksum
==
CRCHelper
::
calculateCRC
(
checkString
,
readSize
));
}
}
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