added const char* test
This commit is contained in:
parent
96dfe46e25
commit
e45a99143c
@ -93,7 +93,7 @@ TEST_CASE("CFDP TLV", "[cfdp][lv]") {
|
||||
SerializeIF::STREAM_TOO_SHORT);
|
||||
}
|
||||
|
||||
SECTION("String LV") {
|
||||
SECTION("String LV String") {
|
||||
std::string filename = "hello.txt";
|
||||
StringLv sourceFileName(filename);
|
||||
REQUIRE(sourceFileName.getSerializedSize() == 1 + filename.size());
|
||||
@ -102,4 +102,15 @@ TEST_CASE("CFDP TLV", "[cfdp][lv]") {
|
||||
std::string filenameFromRaw(reinterpret_cast<const char*>(rawBuf.data() + 1), filename.size());
|
||||
REQUIRE(filenameFromRaw == filename);
|
||||
}
|
||||
|
||||
SECTION("String LV Const Char") {
|
||||
const char filename[] = "hello.txt";
|
||||
StringLv sourceFileName(filename, sizeof(filename) - 1);
|
||||
REQUIRE(sourceFileName.getSerializedSize() == 1 + sizeof(filename) - 1);
|
||||
REQUIRE(sourceFileName.serializeBe(rawBuf.data(), deserSize, rawBuf.size()) == result::OK);
|
||||
REQUIRE(rawBuf[0] == sizeof(filename) - 1);
|
||||
rawBuf[deserSize] = '\0';
|
||||
const char* filenameFromRaw = reinterpret_cast<const char*>(rawBuf.data() + 1);
|
||||
REQUIRE(std::strcmp(filename, filenameFromRaw) == 0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user