diff --git a/CHANGELOG.md b/CHANGELOG.md index dfc140b32..26df4486d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - GPIO HAL: Renamed entries of enumerations to avoid nameclashes with Windows defines. `IN` and `OUT` in `Direction` changed to `DIR_IN` and `DIR_OUT`. `CALLBACK` in `GpioTypes` changed to `TYPE_CALLBACK` +- HAL Devicehandlers: Periodic printout is run-time configurable now - `oneShotAction` flag in the `TestTask` class is not static anymore ## Removed diff --git a/CMakeLists.txt b/CMakeLists.txt index 79258db2d..9786d5728 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -281,6 +281,24 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") -Wimplicit-fallthrough=1 -Wno-unused-parameter -Wno-psabi + -Wduplicated-cond # check for duplicate conditions + -Wduplicated-branches # check for duplicate branches + -Wlogical-op # Search for bitwise operations instead of logical + -Wnull-dereference # Search for NULL dereference + -Wundef # Warn if undefind marcos are used + -Wformat=2 # Format string problem detection + -Wformat-overflow=2 # Formatting issues in printf + -Wformat-truncation=2 # Formatting issues in printf + -Wformat-security # Search for dangerous printf operations + -Wstrict-overflow=3 # Warn if integer overflows might happen + -Warray-bounds=2 # Some array bounds violations will be found + -Wshift-overflow=2 # Search for bit left shift overflows (second.replyBuffer.data(); // Size check to prevent buffer overflow if (requestLen > uartCookie.getMaxReplyLen()) { -#if OBSW_VERBOSE_LEVEL >= 1 +#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "UartComIF::requestReceiveMessage: Next read would cause overflow!" << std::endl; diff --git a/src/fsfw/FSFW.h.in b/src/fsfw/FSFW.h.in index 45b4afc3e..9cfeab61b 100644 --- a/src/fsfw/FSFW.h.in +++ b/src/fsfw/FSFW.h.in @@ -62,9 +62,4 @@ #define FSFW_HAL_I2C_WIRETAPPING 0 #endif -// Can be used for low-level debugging of the I2C bus -#ifndef FSFW_HAL_I2C_WIRETAPPING -#define FSFW_HAL_I2C_WIRETAPPING 0 -#endif - #endif /* FSFW_FSFW_H_ */ diff --git a/src/fsfw/cfdp/tlv/FilestoreTlvBase.h b/src/fsfw/cfdp/tlv/FilestoreTlvBase.h index bb9f10bba..04012cda2 100644 --- a/src/fsfw/cfdp/tlv/FilestoreTlvBase.h +++ b/src/fsfw/cfdp/tlv/FilestoreTlvBase.h @@ -6,10 +6,13 @@ #include #include #include +#include #include #include +#include "fsfw/FSFW.h" + namespace cfdp { enum FilestoreActionCode { diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index 1e87e8a7f..03f8da547 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -825,7 +825,7 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData, DeviceCommandId } ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress, uint8_t** data, - uint32_t* len) { + size_t* len) { size_t lenTmp; if (IPCStore == nullptr) { diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index e88936158..bf6900d93 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -679,7 +679,7 @@ class DeviceHandlerBase : public DeviceHandlerIF, //! Pointer to the raw packet that will be sent. uint8_t *rawPacket = nullptr; //! Size of the #rawPacket. - uint32_t rawPacketLen = 0; + size_t rawPacketLen = 0; /** * The mode the device handler is currently in. @@ -1256,7 +1256,7 @@ class DeviceHandlerBase : public DeviceHandlerIF, * - @c RETURN_FAILED IPCStore is nullptr * - the return value from the IPCStore if it was not @c RETURN_OK */ - ReturnValue_t getStorageData(store_address_t storageAddress, uint8_t **data, uint32_t *len); + ReturnValue_t getStorageData(store_address_t storageAddress, uint8_t **data, size_t *len); /** * @param modeTo either @c MODE_ON, MODE_NORMAL or MODE_RAW, nothing else! diff --git a/src/fsfw/globalfunctions/CRC.cpp b/src/fsfw/globalfunctions/CRC.cpp index 033920d0f..03945612a 100644 --- a/src/fsfw/globalfunctions/CRC.cpp +++ b/src/fsfw/globalfunctions/CRC.cpp @@ -28,7 +28,7 @@ const uint16_t CRC::crc16ccitt_table[256] = { // CRC implementation uint16_t CRC::crc16ccitt(uint8_t const input[], uint32_t length, uint16_t startingCrc) { - uint8_t *data = (uint8_t *)input; + const uint8_t *data = static_cast(input); unsigned int tbl_idx; while (length--) { @@ -39,88 +39,4 @@ uint16_t CRC::crc16ccitt(uint8_t const input[], uint32_t length, uint16_t starti } return startingCrc & 0xffff; - // The part below is not used! - // bool temr[16]; - // bool xor_out[16]; - // bool r[16]; - // bool d[8]; - // uint16_t crc_value = 0; - // - // - // for (int i=0; i<16 ;i++) { - // temr[i] = false; - // xor_out[i] = false; - // } - // - // - // for (int i=0; i<16 ;i++) - // r[i] = true; // initialize with 0xFFFF - // - // - // - // for (int j=0; j +#include #include "fsfw/serviceinterface/ServiceInterface.h" @@ -68,7 +69,7 @@ void arrayprinter::printHex(const uint8_t *data, size_t size, size_t maxCharPerL currentPos += snprintf(printBuffer + currentPos, 6, "%02x", data[i]); if (i < size - 1) { currentPos += sprintf(printBuffer + currentPos, ","); - if (i > 0 and (i + 1) % maxCharPerLine == 0) { + if ((i + 1) % maxCharPerLine == 0) { currentPos += sprintf(printBuffer + currentPos, "\n"); } } @@ -97,20 +98,21 @@ void arrayprinter::printDec(const uint8_t *data, size_t size, size_t maxCharPerL } std::cout << "]" << std::endl; #else - // General format: 32, 243, -12 so it is number of chars times 5 + // General format: 32,243,-12 so it is number of chars times 4 // plus line break plus small safety margin. - char printBuffer[(size + 1) * 5 + 1] = {}; + uint16_t expectedLines = ceil((double)size / maxCharPerLine); + char printBuffer[size * 4 + 1 + expectedLines] = {}; size_t currentPos = 0; for (size_t i = 0; i < size; i++) { // To avoid buffer overflows. - if (sizeof(printBuffer) - currentPos <= 5) { + if (sizeof(printBuffer) - currentPos <= 4) { break; } - currentPos += snprintf(printBuffer + currentPos, 3, "%d", data[i]); + currentPos += snprintf(printBuffer + currentPos, 4, "%d", data[i]); if (i < size - 1) { currentPos += sprintf(printBuffer + currentPos, ","); - if (i > 0 and (i + 1) % maxCharPerLine == 0) { + if ((i + 1) % maxCharPerLine == 0) { currentPos += sprintf(printBuffer + currentPos, "\n"); } } diff --git a/src/fsfw/osal/linux/BinarySemaphore.cpp b/src/fsfw/osal/linux/BinarySemaphore.cpp index ffe0e3a88..4fb67f15d 100644 --- a/src/fsfw/osal/linux/BinarySemaphore.cpp +++ b/src/fsfw/osal/linux/BinarySemaphore.cpp @@ -1,6 +1,7 @@ #include "fsfw/osal/linux/BinarySemaphore.h" #include +#include #include #include diff --git a/src/fsfw/serviceinterface/ServiceInterfacePrinter.h b/src/fsfw/serviceinterface/ServiceInterfacePrinter.h index 89d793c35..65f7250ab 100644 --- a/src/fsfw/serviceinterface/ServiceInterfacePrinter.h +++ b/src/fsfw/serviceinterface/ServiceInterfacePrinter.h @@ -1,6 +1,8 @@ #ifndef FSFW_SERVICEINTERFACE_SERVICEINTERFACEPRINTER #define FSFW_SERVICEINTERFACE_SERVICEINTERFACEPRINTER +#include "fsfw/FSFW.h" + #if FSFW_DISABLE_PRINTOUT == 0 #include #endif diff --git a/src/fsfw/storagemanager/LocalPool.cpp b/src/fsfw/storagemanager/LocalPool.cpp index 075de4b82..cee1d4070 100644 --- a/src/fsfw/storagemanager/LocalPool.cpp +++ b/src/fsfw/storagemanager/LocalPool.cpp @@ -110,7 +110,7 @@ ReturnValue_t LocalPool::modifyData(store_address_t storeId, uint8_t** packetPtr } ReturnValue_t LocalPool::deleteData(store_address_t storeId) { -#if FSFW_VERBOSE_PRINTOUT == 2 +#if FSFW_VERBOSE_LEVEL >= 2 #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::debug << "Delete: Pool: " << std::dec << storeId.poolIndex << " Index: " << storeId.packetIndex << std::endl; @@ -148,7 +148,7 @@ ReturnValue_t LocalPool::deleteData(uint8_t* ptr, size_t size, store_address_t* // element of an object. localId.packetIndex = deltaAddress / elementSizes[n]; result = deleteData(localId); -#if FSFW_VERBOSE_PRINTOUT == 2 +#if FSFW_VERBOSE_LEVEL >= 2 if (deltaAddress % elementSizes[n] != 0) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "LocalPool::deleteData: Address not aligned!" << std::endl; @@ -219,7 +219,7 @@ ReturnValue_t LocalPool::reserveSpace(const size_t size, store_address_t* storeI status = findEmpty(storeId->poolIndex, &storeId->packetIndex); } if (status == RETURN_OK) { -#if FSFW_VERBOSE_PRINTOUT == 2 +#if FSFW_VERBOSE_LEVEL >= 2 #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::debug << "Reserve: Pool: " << std::dec << storeId->poolIndex << " Index: " << storeId->packetIndex << std::endl; @@ -257,7 +257,7 @@ void LocalPool::setToSpillToHigherPools(bool enable) { this->spillsToHigherPools ReturnValue_t LocalPool::getSubPoolIndex(size_t packetSize, uint16_t* subpoolIndex, uint16_t startAtIndex) { for (uint16_t n = startAtIndex; n < NUMBER_OF_SUBPOOLS; n++) { -#if FSFW_VERBOSE_PRINTOUT == 2 +#if FSFW_VERBOSE_LEVEL >= 2 #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::debug << "LocalPool " << getObjectId() << "::getPoolIndex: Pool: " << n << ", Element Size: " << elementSizes[n] << std::endl; diff --git a/src/fsfw/storagemanager/PoolManager.cpp b/src/fsfw/storagemanager/PoolManager.cpp index 6ff003609..92de1dfe0 100644 --- a/src/fsfw/storagemanager/PoolManager.cpp +++ b/src/fsfw/storagemanager/PoolManager.cpp @@ -17,7 +17,7 @@ ReturnValue_t PoolManager::reserveSpace(const size_t size, store_address_t* addr } ReturnValue_t PoolManager::deleteData(store_address_t storeId) { -#if FSFW_VERBOSE_PRINTOUT == 2 +#if FSFW_VERBOSE_LEVEL >= 2 #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::debug << "PoolManager( " << translateObject(getObjectId()) << " )::deleteData from store " << storeId.poolIndex << ". id is " << storeId.packetIndex << std::endl; diff --git a/src/fsfw/timemanager/CCSDSTime.cpp b/src/fsfw/timemanager/CCSDSTime.cpp index 4445fd244..290d58dce 100644 --- a/src/fsfw/timemanager/CCSDSTime.cpp +++ b/src/fsfw/timemanager/CCSDSTime.cpp @@ -109,8 +109,8 @@ ReturnValue_t CCSDSTime::convertFromCCS(Clock::TimeOfDay_t* to, const uint8_t* f if (result != RETURN_OK) { return result; } - - Ccs_mseconds* temp = (Ccs_mseconds*)from; + // At this point we made sure that this is a valid ccs time + const Ccs_mseconds* temp = reinterpret_cast(from); to->year = (temp->yearMSB << 8) + temp->yearLSB; to->hour = temp->hour; @@ -118,16 +118,19 @@ ReturnValue_t CCSDSTime::convertFromCCS(Clock::TimeOfDay_t* to, const uint8_t* f to->second = temp->second; if (temp->pField & (1 << 3)) { // day of year variation - uint16_t tempDay = (temp->month << 8) + temp->day; - result = convertDaysOfYear(tempDay, to->year, &(temp->month), &(temp->day)); + uint16_t tempDayOfYear = (temp->month << 8) + temp->day; + uint8_t tempDay = 0; + uint8_t tempMonth = 0; + result = convertDaysOfYear(tempDayOfYear, to->year, &tempMonth, &tempDay); if (result != RETURN_OK) { return result; } + to->month = tempMonth; + to->day = tempDay; + } else { + to->month = temp->month; + to->day = temp->day; } - - to->month = temp->month; - to->day = temp->day; - to->usecond = 0; if (subsecondsLength > 0) { *foundLength += 1; @@ -162,7 +165,7 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to, const uint8_t* uint16_t hour; uint16_t minute; float second; - int count = sscanf((char*)from, + int count = sscanf((const char*)from, "%4" SCNu16 "-%2" SCNu16 "-%2" SCNu16 "T%" "2" SCNu16 ":%2" SCNu16 ":%fZ", @@ -179,7 +182,7 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to, const uint8_t* } // try Code B (yyyy-ddd) - count = sscanf((char*)from, + count = sscanf((const char*)from, "%4" SCNu16 "-%3" SCNu16 "T%2" SCNu16 ":%" "2" SCNu16 ":%fZ", @@ -211,7 +214,7 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to, const uint8_t* float second; // try Code A (yyyy-mm-dd) int count = - sscanf((char*)from, "%4" SCNu16 "-%2" SCNu8 "-%2" SCNu16 "T%2" SCNu8 ":%2" SCNu8 ":%fZ", + sscanf((const char*)from, "%4" SCNu16 "-%2" SCNu8 "-%2" SCNu16 "T%2" SCNu8 ":%2" SCNu8 ":%fZ", &year, &month, &day, &hour, &minute, &second); if (count == 6) { to->year = year; @@ -225,8 +228,8 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to, const uint8_t* } // try Code B (yyyy-ddd) - count = sscanf((char*)from, "%4" SCNu16 "-%3" SCNu16 "T%2" SCNu8 ":%2" SCNu8 ":%fZ", &year, &day, - &hour, &minute, &second); + count = sscanf((const char*)from, "%4" SCNu16 "-%3" SCNu16 "T%2" SCNu8 ":%2" SCNu8 ":%fZ", &year, + &day, &hour, &minute, &second); if (count == 5) { uint8_t tempDay; ReturnValue_t result = CCSDSTime::convertDaysOfYear(day, year, &month, &tempDay); @@ -248,7 +251,7 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to, const uint8_t* } ReturnValue_t CCSDSTime::checkCcs(const uint8_t* time, uint8_t length) { - Ccs_mseconds* time_struct = (Ccs_mseconds*)time; + const Ccs_mseconds* time_struct = reinterpret_cast(time); uint8_t additionalBytes = time_struct->pField & 0b111; if ((additionalBytes == 0b111) || (length < (additionalBytes + 8))) { @@ -278,7 +281,7 @@ ReturnValue_t CCSDSTime::checkCcs(const uint8_t* time, uint8_t length) { return INVALID_TIME_FORMAT; } - uint8_t* additionalByte = &time_struct->secondEminus2; + const uint8_t* additionalByte = &time_struct->secondEminus2; for (; additionalBytes != 0; additionalBytes--) { if (*additionalByte++ > 99) { diff --git a/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt b/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt index 3b29f23fc..79f847bff 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt @@ -2,4 +2,5 @@ target_sources(${FSFW_TEST_TGT} PRIVATE testDleEncoder.cpp testOpDivider.cpp testBitutil.cpp + testCRC.cpp ) diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testCRC.cpp b/tests/src/fsfw_tests/unit/globalfunctions/testCRC.cpp new file mode 100644 index 000000000..b163ea1fc --- /dev/null +++ b/tests/src/fsfw_tests/unit/globalfunctions/testCRC.cpp @@ -0,0 +1,14 @@ +#include + +#include "catch2/catch_test_macros.hpp" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw_tests/unit/CatchDefinitions.h" + +TEST_CASE("CRC", "[CRC]") { + std::array testData = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + uint16_t crc = CRC::crc16ccitt(testData.data(), 10); + REQUIRE(crc == 49729); + for (uint8_t index = 0; index < testData.size(); index++) { + REQUIRE(testData[index] == index); + } +} \ No newline at end of file diff --git a/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in b/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in index f05ef40bd..ef58f4cd0 100644 --- a/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in +++ b/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in @@ -11,10 +11,12 @@ //! More FSFW related printouts depending on level. Useful for development. #define FSFW_VERBOSE_LEVEL 0 - + //! Can be used to completely disable printouts, even the C stdio ones. #if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0 #define FSFW_DISABLE_PRINTOUT 1 +#else + #define FSFW_DISABLE_PRINTOUT 0 #endif #define FSFW_USE_PUS_C_TELEMETRY 1 diff --git a/tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt b/tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt index 6ce1c6c6c..4b1693a93 100644 --- a/tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt @@ -1,3 +1,4 @@ target_sources(${FSFW_TEST_TGT} PRIVATE TestCountdown.cpp + TestCCSDSTime.cpp ) diff --git a/tests/src/fsfw_tests/unit/timemanager/TestCCSDSTime.cpp b/tests/src/fsfw_tests/unit/timemanager/TestCCSDSTime.cpp new file mode 100644 index 000000000..89713488b --- /dev/null +++ b/tests/src/fsfw_tests/unit/timemanager/TestCCSDSTime.cpp @@ -0,0 +1,92 @@ +#include + +#include +#include +#include + +#include "fsfw_tests/unit/CatchDefinitions.h" + +TEST_CASE("CCSDSTime Tests", "[TestCCSDSTime]") { + INFO("CCSDSTime Tests"); + CCSDSTime::Ccs_mseconds cssMilliSecconds; + Clock::TimeOfDay_t time; + time.year = 2020; + time.month = 2; + time.day = 29; + time.hour = 13; + time.minute = 24; + time.second = 45; + time.usecond = 123456; + SECTION("Test CCS Time") { + auto result = CCSDSTime::convertToCcsds(&cssMilliSecconds, &time); + REQUIRE(result == HasReturnvaluesIF::RETURN_OK); + REQUIRE(cssMilliSecconds.pField == 0x52); // 0b01010010 + REQUIRE(cssMilliSecconds.yearMSB == 0x07); + REQUIRE(cssMilliSecconds.yearLSB == 0xe4); + REQUIRE(cssMilliSecconds.month == 2); + REQUIRE(cssMilliSecconds.day == 29); + REQUIRE(cssMilliSecconds.hour == 13); + REQUIRE(cssMilliSecconds.minute == 24); + REQUIRE(cssMilliSecconds.second == 45); + uint16_t secondsMinus4 = (static_cast(cssMilliSecconds.secondEminus2) * 100) + + cssMilliSecconds.secondEminus4; + REQUIRE(secondsMinus4 == 1234); + Clock::TimeOfDay_t timeTo; + const uint8_t* dataPtr = reinterpret_cast(&cssMilliSecconds); + size_t length = sizeof(CCSDSTime::Ccs_mseconds); + result = CCSDSTime::convertFromCCS(&timeTo, dataPtr, &length, sizeof(CCSDSTime::Ccs_mseconds)); + REQUIRE(result == HasReturnvaluesIF::RETURN_OK); + REQUIRE(cssMilliSecconds.pField == 0x52); // 0b01010010 + REQUIRE(cssMilliSecconds.yearMSB == 0x07); + REQUIRE(cssMilliSecconds.yearLSB == 0xe4); + REQUIRE(cssMilliSecconds.month == 2); + REQUIRE(cssMilliSecconds.day == 29); + REQUIRE(cssMilliSecconds.hour == 13); + REQUIRE(cssMilliSecconds.minute == 24); + REQUIRE(cssMilliSecconds.second == 45); + REQUIRE(timeTo.year == 2020); + REQUIRE(timeTo.month == 2); + REQUIRE(timeTo.day == 29); + REQUIRE(timeTo.hour == 13); + REQUIRE(timeTo.minute == 24); + REQUIRE(timeTo.second == 45); + REQUIRE(timeTo.usecond == 123400); + } + SECTION("CCS_Day of Year") { + Clock::TimeOfDay_t timeTo; + std::array ccsDayOfYear = {0b01011000, 0x07, 0xe4, 0, 60, 13, 24, 45}; + size_t length = ccsDayOfYear.size(); + auto result = + CCSDSTime::convertFromCCS(&timeTo, ccsDayOfYear.data(), &length, ccsDayOfYear.size()); + REQUIRE(result == HasReturnvaluesIF::RETURN_OK); + // Check constness + REQUIRE(ccsDayOfYear[0] == 0b01011000); + REQUIRE(ccsDayOfYear[1] == 0x07); + REQUIRE(ccsDayOfYear[2] == 0xe4); + REQUIRE(ccsDayOfYear[3] == 0x0); + REQUIRE(ccsDayOfYear[4] == 60); + REQUIRE(ccsDayOfYear[5] == 13); + REQUIRE(ccsDayOfYear[6] == 24); + REQUIRE(ccsDayOfYear[7] == 45); + REQUIRE(timeTo.year == 2020); + REQUIRE(timeTo.month == 2); + REQUIRE(timeTo.day == 29); + REQUIRE(timeTo.hour == 13); + REQUIRE(timeTo.minute == 24); + REQUIRE(timeTo.second == 45); + REQUIRE(timeTo.usecond == 0); + } + SECTION("Test convertFromASCII") { + std::string timeAscii = "2022-12-31T23:59:59.123Z"; + Clock::TimeOfDay_t timeTo; + const uint8_t* timeChar = reinterpret_cast(timeAscii.c_str()); + CCSDSTime::convertFromASCII(&timeTo, timeChar, timeAscii.length()); + REQUIRE(timeTo.year == 2022); + REQUIRE(timeTo.month == 12); + REQUIRE(timeTo.day == 31); + REQUIRE(timeTo.hour == 23); + REQUIRE(timeTo.minute == 59); + REQUIRE(timeTo.second == 59); + REQUIRE(timeTo.usecond == Catch::Approx(123000)); + } +} \ No newline at end of file