added some more basic tests
This commit is contained in:
parent
0bb82e0da2
commit
6930656d4e
@ -8,7 +8,7 @@ namespace cfdp {
|
|||||||
class RemoteConfigTableIF {
|
class RemoteConfigTableIF {
|
||||||
public:
|
public:
|
||||||
virtual ~RemoteConfigTableIF() = default;
|
virtual ~RemoteConfigTableIF() = default;
|
||||||
virtual bool getRemoteCfg(EntityId remoteId, RemoteEntityCfg* cfg) = 0;
|
virtual bool getRemoteCfg(const cfdp::EntityId& remoteId, cfdp::RemoteEntityCfg** cfg) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cfdp
|
} // namespace cfdp
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include "fsfw/cfdp.h"
|
#include "fsfw/cfdp.h"
|
||||||
|
#include "mocks/FilesystemMock.h"
|
||||||
#include "mocks/cfdp/FaultHandlerMock.h"
|
#include "mocks/cfdp/FaultHandlerMock.h"
|
||||||
|
#include "mocks/cfdp/RemoteConfigTableMock.h"
|
||||||
#include "mocks/cfdp/UserMock.h"
|
#include "mocks/cfdp/UserMock.h"
|
||||||
|
|
||||||
TEST_CASE("CFDP Dest Handler", "[cfdp]") {
|
TEST_CASE("CFDP Dest Handler", "[cfdp]") {
|
||||||
@ -9,7 +11,10 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
|
|||||||
EntityId localId = EntityId(UnsignedByteField<uint16_t>(2));
|
EntityId localId = EntityId(UnsignedByteField<uint16_t>(2));
|
||||||
auto fhMock = FaultHandlerMock();
|
auto fhMock = FaultHandlerMock();
|
||||||
auto localEntityCfg = LocalEntityCfg(localId, IndicationCfg(), fhMock);
|
auto localEntityCfg = LocalEntityCfg(localId, IndicationCfg(), fhMock);
|
||||||
// auto userMock = UserMock();
|
auto fsMock = FilesystemMock();
|
||||||
|
auto userMock = UserMock(fsMock);
|
||||||
|
auto remoteCfgTableMock = RemoteConfigTableMock();
|
||||||
|
auto destHandler = DestHandler(localEntityCfg, userMock, remoteCfgTableMock);
|
||||||
|
|
||||||
SECTION("State") {}
|
SECTION("State") {}
|
||||||
}
|
}
|
@ -1,6 +1,15 @@
|
|||||||
#include "RemoteConfigTableMock.h"
|
#include "RemoteConfigTableMock.h"
|
||||||
|
|
||||||
bool cfdp::RemoteConfigTableMock::getRemoteCfg(cfdp::EntityId remoteId,
|
void cfdp::RemoteConfigTableMock::addRemoteConfig(const cfdp::RemoteEntityCfg& cfg) {
|
||||||
cfdp::RemoteEntityCfg *cfg) {
|
remoteCfgTable.emplace(cfg.remoteId, cfg);
|
||||||
return false;
|
}
|
||||||
|
|
||||||
|
bool cfdp::RemoteConfigTableMock::getRemoteCfg(const cfdp::EntityId& remoteId,
|
||||||
|
cfdp::RemoteEntityCfg** cfg) {
|
||||||
|
auto iter = remoteCfgTable.find(remoteId);
|
||||||
|
if (iter == remoteCfgTable.end()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*cfg = &iter->second;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
#ifndef FSFW_TESTS_CFDP_REMOTCONFIGTABLEMOCK_H
|
#ifndef FSFW_TESTS_CFDP_REMOTCONFIGTABLEMOCK_H
|
||||||
#define FSFW_TESTS_CFDP_REMOTCONFIGTABLEMOCK_H
|
#define FSFW_TESTS_CFDP_REMOTCONFIGTABLEMOCK_H
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include "fsfw/cfdp/handler/RemoteConfigTableIF.h"
|
#include "fsfw/cfdp/handler/RemoteConfigTableIF.h"
|
||||||
|
|
||||||
namespace cfdp {
|
namespace cfdp {
|
||||||
|
|
||||||
class RemoteConfigTableMock : public RemoteConfigTableIF {
|
class RemoteConfigTableMock : public RemoteConfigTableIF {
|
||||||
public:
|
public:
|
||||||
bool getRemoteCfg(EntityId remoteId, RemoteEntityCfg *cfg) override;
|
void addRemoteConfig(const RemoteEntityCfg& cfg);
|
||||||
|
bool getRemoteCfg(const cfdp::EntityId& remoteId, cfdp::RemoteEntityCfg** cfg) override;
|
||||||
|
|
||||||
|
std::map<EntityId, RemoteEntityCfg> remoteCfgTable;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cfdp
|
} // namespace cfdp
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
namespace cfdp {
|
namespace cfdp {
|
||||||
|
|
||||||
class UserMock : public UserBase {
|
class UserMock : public UserBase {
|
||||||
|
public:
|
||||||
explicit UserMock(HasFileSystemIF& vfs);
|
explicit UserMock(HasFileSystemIF& vfs);
|
||||||
|
|
||||||
public:
|
|
||||||
void transactionIndication(TransactionId id) override;
|
void transactionIndication(TransactionId id) override;
|
||||||
void eofSentIndication(TransactionId id) override;
|
void eofSentIndication(TransactionId id) override;
|
||||||
void abandonedIndication(TransactionId id, ConditionCode code, size_t progress) override;
|
void abandonedIndication(TransactionId id, ConditionCode code, size_t progress) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user