added some tests
This commit is contained in:
parent
b2e4438811
commit
3789663db7
@ -84,8 +84,6 @@ TEST_CASE("DataSetTest" , "[DataSetTest]") {
|
||||
CHECK(localSet.localPoolUint16Vec.getReadWriteMode() == pool_rwm_t::VAR_READ);
|
||||
CHECK(localSet.localPoolVarUint8.getReadWriteMode() == pool_rwm_t::VAR_READ);
|
||||
CHECK(localSet.localPoolVarFloat.getReadWriteMode() == pool_rwm_t::VAR_READ);
|
||||
/* For code coverage */
|
||||
localSet.initializePeriodicHelper(0.0, 0.4, false);
|
||||
|
||||
{
|
||||
/* Now we read again and check whether our zeroed values were overwritten with
|
||||
|
@ -28,6 +28,10 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") {
|
||||
|
||||
|
||||
SECTION("BasicTest") {
|
||||
auto owner = poolOwner->poolManager.getOwner();
|
||||
REQUIRE(owner != nullptr);
|
||||
CHECK(owner->getObjectId() == objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
|
||||
/* Subscribe for message generation on update. */
|
||||
REQUIRE(poolOwner->subscribeWrapperSetUpdate() == retval::CATCH_OK);
|
||||
/* Subscribe for an update message. */
|
||||
@ -190,6 +194,18 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") {
|
||||
REQUIRE(mqMock->receiveMessage(&messageSent) == static_cast<int>(MessageQueueIF::EMPTY));
|
||||
}
|
||||
|
||||
SECTION("Periodic HK") {
|
||||
/* Now we subcribe for a HK periodic generation. Even when it's difficult to simulate
|
||||
the temporal behaviour correctly the HK manager should generate a HK packet
|
||||
immediately and the periodic helper depends on HK op function calls anyway instead of
|
||||
using the clock, so we could also just call performHkOperation multiple times */
|
||||
REQUIRE(poolOwner->subscribePeriodicHk() == retval::CATCH_OK);
|
||||
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
||||
/* Now HK packet should be sent as message. */
|
||||
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
||||
CHECK(messagesSent == 1);
|
||||
}
|
||||
|
||||
/* we need to reset the subscription list because the pool owner
|
||||
is a global object. */
|
||||
CHECK(poolOwner->reset() == retval::CATCH_OK);
|
||||
|
@ -130,7 +130,7 @@ public:
|
||||
}
|
||||
|
||||
uint32_t getPeriodicOperationFrequency() const override {
|
||||
return 0;
|
||||
return 0.2;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,6 +169,10 @@ public:
|
||||
return dynamic_cast<MessageQueueMockBase*>(messageQueue);
|
||||
}
|
||||
|
||||
ReturnValue_t subscribePeriodicHk() {
|
||||
return poolManager.subscribeForPeriodicPacket(lpool::testSid, true, 0.2, false);
|
||||
}
|
||||
|
||||
ReturnValue_t subscribeWrapperSetUpdate() {
|
||||
return poolManager.subscribeForSetUpdateMessage(lpool::testSetId,
|
||||
objects::NO_OBJECT, objects::HK_RECEIVER_MOCK, false);
|
||||
|
Loading…
Reference in New Issue
Block a user