that should do the job
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
parent
398e7a3a05
commit
6a0b18ffd0
@ -48,6 +48,7 @@
|
|||||||
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1
|
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1
|
||||||
#define OBSW_PRINT_MISSED_DEADLINES 1
|
#define OBSW_PRINT_MISSED_DEADLINES 1
|
||||||
|
|
||||||
|
#define OBSW_MPSOC_JTAG_BOOT 0
|
||||||
#define OBSW_SYRLINKS_SIMULATED 1
|
#define OBSW_SYRLINKS_SIMULATED 1
|
||||||
#define OBSW_ADD_TEST_CODE 0
|
#define OBSW_ADD_TEST_CODE 0
|
||||||
#define OBSW_ADD_TEST_TASK 0
|
#define OBSW_ADD_TEST_TASK 0
|
||||||
|
@ -850,7 +850,9 @@ class TcSimplexSendFile : public TcBase {
|
|||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (chunkParameter == 0) {
|
/// No chunks makes no sense, and DIV str can not be longer than whats representable with 3
|
||||||
|
/// decimal digits.
|
||||||
|
if (chunkParameter == 0 or chunkParameter > 999) {
|
||||||
return INVALID_PARAMETER;
|
return INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
std::string fileName(reinterpret_cast<const char*>(*dataPtr));
|
std::string fileName(reinterpret_cast<const char*>(*dataPtr));
|
||||||
@ -860,8 +862,8 @@ class TcSimplexSendFile : public TcBase {
|
|||||||
size_t currentCopyIdx = 0;
|
size_t currentCopyIdx = 0;
|
||||||
size_t payloadLen = fileName.length() + sizeof(NULL_TERMINATOR) + CRC_SIZE;
|
size_t payloadLen = fileName.length() + sizeof(NULL_TERMINATOR) + CRC_SIZE;
|
||||||
if (chunkParameter > 1) {
|
if (chunkParameter > 1) {
|
||||||
char divStr[12]{};
|
char divStr[16]{};
|
||||||
sprintf(divStr, "DIV%03d", chunkParameter);
|
sprintf(divStr, "DIV%03u", chunkParameter);
|
||||||
std::memcpy(payloadStart, divStr, DIV_STR_LEN);
|
std::memcpy(payloadStart, divStr, DIV_STR_LEN);
|
||||||
payloadLen += DIV_STR_LEN;
|
payloadLen += DIV_STR_LEN;
|
||||||
currentCopyIdx += DIV_STR_LEN;
|
currentCopyIdx += DIV_STR_LEN;
|
||||||
|
@ -6,5 +6,6 @@ target_sources(${UNITTEST_NAME} PRIVATE
|
|||||||
testEnvironment.cpp
|
testEnvironment.cpp
|
||||||
testGenericFilesystem.cpp
|
testGenericFilesystem.cpp
|
||||||
hdlcEncodingRw.cpp
|
hdlcEncodingRw.cpp
|
||||||
|
mpsocTests.cpp
|
||||||
printChar.cpp
|
printChar.cpp
|
||||||
)
|
)
|
14
unittest/mpsocTests.cpp
Normal file
14
unittest/mpsocTests.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
|
TEST_CASE("MPSoC helper tests", "[payload]") {
|
||||||
|
char divStr[16]{};
|
||||||
|
uint32_t divParam = 0;
|
||||||
|
|
||||||
|
SECTION("Simple Test") {
|
||||||
|
divParam = 3;
|
||||||
|
CHECK(divParam < 999);
|
||||||
|
sprintf(divStr, "DIV%03u", divParam);
|
||||||
|
REQUIRE(strcmp(divStr, "DIV003") == 0);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user