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