this should work
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-12-12 16:30:16 +01:00
parent 279697b326
commit a9699ad969
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -8,11 +8,14 @@ TEST_CASE("Stamp in Filename", "[Stamp In Filename]") {
Clock::TimeOfDay_t tod; Clock::TimeOfDay_t tod;
std::string baseName = "verif"; std::string baseName = "verif";
std::string pathStr = "verif_2022-05-25T16:55:23Z.bin"; std::string pathStr = "verif_2022-05-25T16:55:23Z.bin";
unsigned int underscorePos = pathStr.find_last_of('_');
std::string stampStr = pathStr.substr(underscorePos + 1);
float seconds = 0.0; float seconds = 0.0;
char* prefix = nullptr; char* prefix = nullptr;
int count = int count =
sscanf(pathStr.c_str(), sscanf(stampStr.c_str(),
"%s_%4" SCNu32 "-%2" SCNu32 "-%2" SCNu32 "T%2" SCNu32 ":%2" SCNu32 ":%2" SCNu32 "Z", "%4" SCNu32 "-%2" SCNu32 "-%2" SCNu32 "T%2" SCNu32 ":%2" SCNu32 ":%2" SCNu32 "Z",
prefix, &tod.year, &tod.month, &tod.day, &tod.hour, &tod.minute, &tod.second); &tod.year, &tod.month, &tod.day, &tod.hour, &tod.minute, &tod.second);
static_cast<void>(count); static_cast<void>(count);
CHECK(count == 6);
} }