EIVE upstream #29

Merged
muellerr merged 693 commits from use-eive-upstream into develop 2023-06-30 15:44:39 +02:00
7 changed files with 20 additions and 17 deletions
Showing only changes of commit 6ca1a5c796 - Show all commits

View File

@ -3,13 +3,12 @@
#include "fsfw/retval.h" #include "fsfw/retval.h"
using namespace returnvalue;
namespace containers { namespace containers {
static const ReturnValue_t KEY_ALREADY_EXISTS = makeCode(CLASS_ID::FIXED_MAP, 0x01); static const ReturnValue_t KEY_ALREADY_EXISTS = returnvalue::makeCode(CLASS_ID::FIXED_MAP, 0x01);
static const ReturnValue_t MAP_FULL = makeCode(CLASS_ID::FIXED_MAP, 0x02); static const ReturnValue_t MAP_FULL = returnvalue::makeCode(CLASS_ID::FIXED_MAP, 0x02);
static const ReturnValue_t KEY_DOES_NOT_EXIST = makeCode(CLASS_ID::FIXED_MAP, 0x03); static const ReturnValue_t KEY_DOES_NOT_EXIST = returnvalue::makeCode(CLASS_ID::FIXED_MAP, 0x03);
static const ReturnValue_t LIST_FULL = makeCode(CLASS_ID::ARRAY_LIST, 0x01); static const ReturnValue_t LIST_FULL = returnvalue::makeCode(CLASS_ID::ARRAY_LIST, 0x01);
} // namespace containers } // namespace containers
#endif /* FSFW_CONTAINER_DEFINITIONS_H_ */ #endif /* FSFW_CONTAINER_DEFINITIONS_H_ */

View File

@ -22,7 +22,9 @@ UioMapper::UioMapper(std::string uioFile, int mapNum) : mapNum(mapNum) {
if (res) { if (res) {
this->uioFile = res; this->uioFile = res;
} else { } else {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Could not resolve real path of UIO file " << uioFile << std::endl; sif::error << "Could not resolve real path of UIO file " << uioFile << std::endl;
#endif
} }
free(res); free(res);
} else { } else {

View File

@ -43,7 +43,7 @@ TEST_CASE("Array List", "[containers]") {
for (auto i = 0; i < 20; i++) { for (auto i = 0; i < 20; i++) {
REQUIRE(list.insert(i) == static_cast<int>(returnvalue::OK)); REQUIRE(list.insert(i) == static_cast<int>(returnvalue::OK));
} }
REQUIRE(list.insert(20) == static_cast<int>(ArrayList<uint16_t>::FULL)); REQUIRE(list.insert(20) == static_cast<int>(containers::LIST_FULL));
ArrayList<uint16_t>::Iterator it = list.begin(); ArrayList<uint16_t>::Iterator it = list.begin();
REQUIRE((*it) == 0); REQUIRE((*it) == 0);
it++; it++;

View File

@ -31,7 +31,7 @@ TEST_CASE("FixedArrayList Tests", "[containers]") {
for (auto i = 1; i < 260; i++) { for (auto i = 1; i < 260; i++) {
REQUIRE(list.insert(i) == static_cast<int>(returnvalue::OK)); REQUIRE(list.insert(i) == static_cast<int>(returnvalue::OK));
} }
REQUIRE(list.insert(260) == static_cast<int>(ArrayList<uint32_t, uint16_t>::FULL)); REQUIRE(list.insert(260) == static_cast<int>(containers::LIST_FULL));
list.clear(); list.clear();
REQUIRE(list.size == 0); REQUIRE(list.size == 0);
} }

View File

@ -7,6 +7,8 @@
template class FixedMap<unsigned int, unsigned short>; template class FixedMap<unsigned int, unsigned short>;
using namespace returnvalue;
TEST_CASE("FixedMap Tests", "[containers]") { TEST_CASE("FixedMap Tests", "[containers]") {
INFO("FixedMap Tests"); INFO("FixedMap Tests");
@ -24,9 +26,9 @@ TEST_CASE("FixedMap Tests", "[containers]") {
REQUIRE(map.find(i)->second == i + 1); REQUIRE(map.find(i)->second == i + 1);
REQUIRE(not map.empty()); REQUIRE(not map.empty());
} }
REQUIRE(map.insert(0, 0) == static_cast<int>(FixedMap<uint32_t, uint16_t>::KEY_ALREADY_EXISTS)); REQUIRE(map.insert(0, 0) == static_cast<int>(containers::KEY_ALREADY_EXISTS));
REQUIRE(map.insert(31, 0) == static_cast<int>(FixedMap<uint32_t, uint16_t>::MAP_FULL)); REQUIRE(map.insert(31, 0) == static_cast<int>(containers::MAP_FULL));
REQUIRE(map.exists(31) == static_cast<int>(FixedMap<uint32_t, uint16_t>::KEY_DOES_NOT_EXIST)); REQUIRE(map.exists(31) == static_cast<int>(containers::KEY_DOES_NOT_EXIST));
REQUIRE(map.size() == 30); REQUIRE(map.size() == 30);
REQUIRE(map.full()); REQUIRE(map.full());
{ {
@ -35,14 +37,14 @@ TEST_CASE("FixedMap Tests", "[containers]") {
REQUIRE(*ptr == 6); REQUIRE(*ptr == 6);
REQUIRE(*(map.findValue(6)) == 7); REQUIRE(*(map.findValue(6)) == 7);
REQUIRE(map.find(31, &ptr) == REQUIRE(map.find(31, &ptr) ==
static_cast<int>(FixedMap<uint32_t, uint16_t>::KEY_DOES_NOT_EXIST)); static_cast<int>(containers::KEY_DOES_NOT_EXIST));
} }
REQUIRE(map.getSerializedSize() == REQUIRE(map.getSerializedSize() ==
(sizeof(uint32_t) + 30 * (sizeof(uint32_t) + sizeof(uint16_t)))); (sizeof(uint32_t) + 30 * (sizeof(uint32_t) + sizeof(uint16_t))));
REQUIRE(map.erase(2) == static_cast<int>(returnvalue::OK)); REQUIRE(map.erase(2) == static_cast<int>(returnvalue::OK));
REQUIRE(map.erase(31) == static_cast<int>(FixedMap<uint32_t, uint16_t>::KEY_DOES_NOT_EXIST)); REQUIRE(map.erase(31) == static_cast<int>(containers::KEY_DOES_NOT_EXIST));
REQUIRE(map.exists(2) == static_cast<int>(FixedMap<uint32_t, uint16_t>::KEY_DOES_NOT_EXIST)); REQUIRE(map.exists(2) == static_cast<int>(containers::KEY_DOES_NOT_EXIST));
REQUIRE(map.size() == 29); REQUIRE(map.size() == 29);
for (auto element : map) { for (auto element : map) {
@ -80,7 +82,7 @@ TEST_CASE("FixedMap Tests", "[containers]") {
REQUIRE(map.find(37)->second == 38); REQUIRE(map.find(37)->second == 38);
REQUIRE(map.size() == 2); REQUIRE(map.size() == 2);
REQUIRE(map.insert(37, 24, nullptr) == REQUIRE(map.insert(37, 24, nullptr) ==
static_cast<int>(FixedMap<uint32_t, uint16_t>::KEY_ALREADY_EXISTS)); static_cast<int>(containers::KEY_ALREADY_EXISTS));
REQUIRE(map.find(37)->second != 24); REQUIRE(map.find(37)->second != 24);
REQUIRE(map.size() == 2); REQUIRE(map.size() == 2);
}; };
@ -137,7 +139,7 @@ TEST_CASE("FixedMap Tests", "[containers]") {
FixedMap<uint32_t, uint16_t>::Iterator it; FixedMap<uint32_t, uint16_t>::Iterator it;
std::pair<uint32_t, uint16_t> pair = std::make_pair(44, 43); std::pair<uint32_t, uint16_t> pair = std::make_pair(44, 43);
it = FixedMap<uint32_t, uint16_t>::Iterator(&pair); it = FixedMap<uint32_t, uint16_t>::Iterator(&pair);
REQUIRE(map.erase(&it) == static_cast<int>(FixedMap<uint32_t, uint16_t>::KEY_DOES_NOT_EXIST)); REQUIRE(map.erase(&it) == static_cast<int>(containers::KEY_DOES_NOT_EXIST));
REQUIRE(map.find(45) == map.end()); REQUIRE(map.find(45) == map.end());
size_t toLargeMap = 100; size_t toLargeMap = 100;
const uint8_t* ptr = reinterpret_cast<uint8_t*>(&toLargeMap); const uint8_t* ptr = reinterpret_cast<uint8_t*>(&toLargeMap);

View File

@ -6,7 +6,7 @@ AcceptsTmMock::AcceptsTmMock(object_id_t registeredId, MessageQueueId_t queueToR
AcceptsTmMock::AcceptsTmMock(MessageQueueId_t queueToReturn) AcceptsTmMock::AcceptsTmMock(MessageQueueId_t queueToReturn)
: SystemObject(objects::NO_OBJECT, false), returnedQueue(queueToReturn) {} : SystemObject(objects::NO_OBJECT, false), returnedQueue(queueToReturn) {}
MessageQueueId_t AcceptsTmMock::getReportReceptionQueue(uint8_t virtualChannel) { MessageQueueId_t AcceptsTmMock::getReportReceptionQueue(uint8_t virtualChannel) const {
return returnedQueue; return returnedQueue;
} }

View File

@ -9,7 +9,7 @@ class AcceptsTmMock : public SystemObject, public AcceptsTelemetryIF {
AcceptsTmMock(object_id_t registeredId, MessageQueueId_t queueToReturn); AcceptsTmMock(object_id_t registeredId, MessageQueueId_t queueToReturn);
explicit AcceptsTmMock(MessageQueueId_t queueToReturn); explicit AcceptsTmMock(MessageQueueId_t queueToReturn);
MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) override; MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) const override;
const char* getName() const override; const char* getName() const override;
MessageQueueId_t returnedQueue; MessageQueueId_t returnedQueue;