nice
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <filesystem>
|
||||
|
||||
#include "fsfw/cfdp.h"
|
||||
#include "fsfw/cfdp/handler/PutRequest.h"
|
||||
#include "fsfw/cfdp/handler/SourceHandler.h"
|
||||
#include "fsfw/cfdp/pdu/EofPduCreator.h"
|
||||
#include "fsfw/cfdp/pdu/FileDataCreator.h"
|
||||
@ -18,6 +20,7 @@
|
||||
TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
||||
using namespace cfdp;
|
||||
using namespace returnvalue;
|
||||
using namespace std::filesystem;
|
||||
MessageQueueId_t destQueueId = 2;
|
||||
AcceptsTmMock tmReceiver(destQueueId);
|
||||
MessageQueueMock mqMock(destQueueId);
|
||||
@ -36,4 +39,22 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
||||
StorageManagerMock tmStore(3, storeCfg);
|
||||
FsfwParams fp(tmReceiver, &mqMock, &eventReporterMock);
|
||||
auto sourceHandler = SourceHandler(dp, fp);
|
||||
|
||||
SECTION("Test Basic") {
|
||||
CHECK(sourceHandler.getState() == CfdpState::IDLE);
|
||||
CHECK(sourceHandler.getStep() == SourceHandler::TransactionStep::IDLE);
|
||||
}
|
||||
|
||||
SECTION("Transfer empty file") {
|
||||
RemoteEntityCfg cfg;
|
||||
EntityId id(cfdp::WidthInBytes::ONE_BYTE, 5);
|
||||
cfg.remoteId = id;
|
||||
FilesystemParams srcFileName("/tmp/cfdp-test.txt");
|
||||
fsMock.createFile(srcFileName);
|
||||
cfdp::StringLv srcNameLv(srcFileName.path, std::strlen(srcFileName.path));
|
||||
FilesystemParams destFileName("/tmp/cfdp-test.txt");
|
||||
cfdp::StringLv destNameLv(destFileName.path, std::strlen(destFileName.path));
|
||||
PutRequest putRequest(id, srcNameLv, destNameLv);
|
||||
CHECK(sourceHandler.transactionStart(putRequest, cfg) == OK);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user