added more tests

This commit is contained in:
Robin Müller 2021-01-24 21:34:38 +01:00
parent e245f56a4f
commit 094d237814
2 changed files with 24 additions and 4 deletions

View File

@ -63,12 +63,27 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") {
HousekeepingMessage::HK_REPORT)); HousekeepingMessage::HK_REPORT));
/* Clear message to avoid memory leak, our mock won't do it for us (yet) */ /* Clear message to avoid memory leak, our mock won't do it for us (yet) */
CommandMessageCleaner::clearCommandMessage(&messageSent); CommandMessageCleaner::clearCommandMessage(&messageSent);
}
SECTION("AdvancedTests") {
/* we need to reset the subscription list because the pool owner /* we need to reset the subscription list because the pool owner
is a global object. */ is a global object. */
poolOwner->resetSubscriptionList(); poolOwner->resetSubscriptionList();
}
SECTION("SnapshotUpdateTests") {
/* we need to reset the subscription list because the pool owner
is a global object. */
poolOwner->resetSubscriptionList();
/* Subscribe for snapshot generation on update. */
REQUIRE(poolOwner->subscribeWrapperSetUpdateSnapshot() == retval::CATCH_OK);
poolOwner->dataset.setChanged(true);
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
CHECK(messagesSent == 1);
}
SECTION("AdvancedTests") {
/* Subscribe for variable update as well */ /* Subscribe for variable update as well */
REQUIRE(not poolOwner->dataset.hasChanged()); REQUIRE(not poolOwner->dataset.hasChanged());
REQUIRE(poolOwner->subscribeWrapperVariableUpdate(lpool::uint8VarId) == REQUIRE(poolOwner->subscribeWrapperVariableUpdate(lpool::uint8VarId) ==

View File

@ -155,7 +155,12 @@ public:
ReturnValue_t subscribeWrapperSetUpdate() { ReturnValue_t subscribeWrapperSetUpdate() {
return poolManager.subscribeForSetUpdateMessages(lpool::testSetId, return poolManager.subscribeForSetUpdateMessages(lpool::testSetId,
objects::NO_OBJECT, MessageQueueIF::NO_QUEUE, false); objects::NO_OBJECT, objects::HK_RECEIVER_MOCK, false);
}
ReturnValue_t subscribeWrapperSetUpdateSnapshot() {
return poolManager.subscribeForSetUpdateMessages(lpool::testSetId,
objects::NO_OBJECT, objects::HK_RECEIVER_MOCK, true);
} }
ReturnValue_t subscribeWrapperSetUpdateHk(bool diagnostics = false) { ReturnValue_t subscribeWrapperSetUpdateHk(bool diagnostics = false) {