fix unittests
This commit is contained in:
parent
904abfba28
commit
4f1fe39182
@ -71,9 +71,11 @@ TEST_CASE("Keep Alive PDU", "[cfdp][pdu]") {
|
||||
|
||||
// invalid max size
|
||||
for (size_t invalidMaxSz = 0; invalidMaxSz < sz; invalidMaxSz++) {
|
||||
deserializer.setData(kaBuffer.data(), invalidMaxSz);
|
||||
result = deserializer.parseData();
|
||||
REQUIRE(result != HasReturnvaluesIF::RETURN_OK);
|
||||
ReturnValue_t setResult = deserializer.setData(kaBuffer.data(), invalidMaxSz);
|
||||
if (setResult == HasReturnvaluesIF::RETURN_OK) {
|
||||
result = deserializer.parseData();
|
||||
REQUIRE(result != HasReturnvaluesIF::RETURN_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include "fsfw/cfdp/pdu/MetadataPduCreator.h"
|
||||
#include "fsfw/cfdp/pdu/MetadataPduReader.h"
|
||||
@ -172,8 +173,10 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") {
|
||||
info.setOptionsArray(options.data(), &sizeOfOptions, nullptr);
|
||||
for (size_t maxSz = 0; maxSz < 46; maxSz++) {
|
||||
MetadataPduReader invalidSzDeser(mdBuffer.data(), maxSz, info);
|
||||
result = invalidSzDeser.parseData();
|
||||
REQUIRE(result == SerializeIF::STREAM_TOO_SHORT);
|
||||
if (not invalidSzDeser.isNull()) {
|
||||
result = invalidSzDeser.parseData();
|
||||
REQUIRE(result == SerializeIF::STREAM_TOO_SHORT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,9 +59,11 @@ TEST_CASE("Prompt PDU", "[cfdp][pdu]") {
|
||||
rawBuf[2] = 2;
|
||||
|
||||
for (size_t invalidMaxSz = 0; invalidMaxSz < sz; invalidMaxSz++) {
|
||||
deserializer.setData(rawBuf.data(), invalidMaxSz);
|
||||
result = deserializer.parseData();
|
||||
REQUIRE(result != HasReturnvaluesIF::RETURN_OK);
|
||||
ReturnValue_t setResult = deserializer.setData(rawBuf.data(), invalidMaxSz);
|
||||
if (setResult == result::OK) {
|
||||
result = deserializer.parseData();
|
||||
REQUIRE(result != HasReturnvaluesIF::RETURN_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user