updated indentation
This commit is contained in:
parent
cc2e26443d
commit
e245f56a4f
@ -22,11 +22,11 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") {
|
|||||||
|
|
||||||
|
|
||||||
SECTION("BasicTest") {
|
SECTION("BasicTest") {
|
||||||
// Subscribe for message generation on update.
|
/* Subscribe for message generation on update. */
|
||||||
REQUIRE(poolOwner->subscribeWrapperSetUpdate() == retval::CATCH_OK);
|
REQUIRE(poolOwner->subscribeWrapperSetUpdate() == retval::CATCH_OK);
|
||||||
// Subscribe for an update message.
|
/* Subscribe for an update message. */
|
||||||
poolOwner->dataset.setChanged(true);
|
poolOwner->dataset.setChanged(true);
|
||||||
// Now the update message should be generated.
|
/* Now the update message should be generated. */
|
||||||
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
||||||
REQUIRE(mqMock->wasMessageSent() == true);
|
REQUIRE(mqMock->wasMessageSent() == true);
|
||||||
|
|
||||||
@ -34,9 +34,9 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") {
|
|||||||
CHECK(messageSent.getCommand() == static_cast<int>(
|
CHECK(messageSent.getCommand() == static_cast<int>(
|
||||||
HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
||||||
|
|
||||||
// Should have been reset.
|
/* Should have been reset. */
|
||||||
CHECK(poolOwner->dataset.hasChanged() == false);
|
CHECK(poolOwner->dataset.hasChanged() == false);
|
||||||
// Set changed again, result should be the same.
|
/* Set changed again, result should be the same. */
|
||||||
poolOwner->dataset.setChanged(true);
|
poolOwner->dataset.setChanged(true);
|
||||||
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
||||||
|
|
||||||
@ -46,14 +46,14 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") {
|
|||||||
CHECK(messageSent.getCommand() == static_cast<int>(
|
CHECK(messageSent.getCommand() == static_cast<int>(
|
||||||
HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
||||||
|
|
||||||
// now subscribe for set update HK as well.
|
/* Now subscribe for set update HK as well. */
|
||||||
REQUIRE(poolOwner->subscribeWrapperSetUpdateHk() == retval::CATCH_OK);
|
REQUIRE(poolOwner->subscribeWrapperSetUpdateHk() == retval::CATCH_OK);
|
||||||
poolOwner->dataset.setChanged(true);
|
poolOwner->dataset.setChanged(true);
|
||||||
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
||||||
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
||||||
CHECK(messagesSent == 2);
|
CHECK(messagesSent == 2);
|
||||||
// first message sent should be the update notification, considering
|
/* first message sent should be the update notification, considering
|
||||||
// the internal list is a vector checked in insertion order.
|
the internal list is a vector checked in insertion order. */
|
||||||
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
||||||
CHECK(messageSent.getCommand() == static_cast<int>(
|
CHECK(messageSent.getCommand() == static_cast<int>(
|
||||||
HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
HousekeepingMessage::UPDATE_NOTIFICATION_SET));
|
||||||
@ -61,15 +61,15 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") {
|
|||||||
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
||||||
CHECK(messageSent.getCommand() == static_cast<int>(
|
CHECK(messageSent.getCommand() == static_cast<int>(
|
||||||
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") {
|
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();
|
||||||
// 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) ==
|
||||||
retval::CATCH_OK);
|
retval::CATCH_OK);
|
||||||
@ -79,22 +79,22 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") {
|
|||||||
poolVar->setChanged(true);
|
poolVar->setChanged(true);
|
||||||
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
||||||
|
|
||||||
// Check update notification was sent.
|
/* Check update notification was sent. */
|
||||||
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
||||||
CHECK(messagesSent == 1);
|
CHECK(messagesSent == 1);
|
||||||
// Should have been reset.
|
/* Should have been reset. */
|
||||||
CHECK(poolVar->hasChanged() == false);
|
CHECK(poolVar->hasChanged() == false);
|
||||||
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
||||||
CHECK(messageSent.getCommand() == static_cast<int>(
|
CHECK(messageSent.getCommand() == static_cast<int>(
|
||||||
HousekeepingMessage::UPDATE_NOTIFICATION_VARIABLE));
|
HousekeepingMessage::UPDATE_NOTIFICATION_VARIABLE));
|
||||||
|
|
||||||
// now subscribe for the dataset update (HK and update) again
|
/* Now subscribe for the dataset update (HK and update) again */
|
||||||
REQUIRE(poolOwner->subscribeWrapperSetUpdate() == retval::CATCH_OK);
|
REQUIRE(poolOwner->subscribeWrapperSetUpdate() == retval::CATCH_OK);
|
||||||
REQUIRE(poolOwner->subscribeWrapperSetUpdateHk() == retval::CATCH_OK);
|
REQUIRE(poolOwner->subscribeWrapperSetUpdateHk() == retval::CATCH_OK);
|
||||||
|
|
||||||
poolOwner->dataset.setChanged(true);
|
poolOwner->dataset.setChanged(true);
|
||||||
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
||||||
// now two messages should be sent.
|
/* Now two messages should be sent. */
|
||||||
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
||||||
CHECK(messagesSent == 2);
|
CHECK(messagesSent == 2);
|
||||||
mqMock->clearMessages(true);
|
mqMock->clearMessages(true);
|
||||||
@ -102,7 +102,7 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") {
|
|||||||
poolOwner->dataset.setChanged(true);
|
poolOwner->dataset.setChanged(true);
|
||||||
poolVar->setChanged(true);
|
poolVar->setChanged(true);
|
||||||
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
REQUIRE(poolOwner->poolManager.performHkOperation() == retval::CATCH_OK);
|
||||||
// now three messages should be sent.
|
/* Now three messages should be sent. */
|
||||||
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
REQUIRE(mqMock->wasMessageSent(&messagesSent) == true);
|
||||||
CHECK(messagesSent == 3);
|
CHECK(messagesSent == 3);
|
||||||
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
REQUIRE(mqMock->receiveMessage(&messageSent) == retval::CATCH_OK);
|
||||||
|
@ -14,7 +14,7 @@ TEST_CASE("LocalPoolVariable" , "[LocPoolVarTest]") {
|
|||||||
== retval::CATCH_OK);
|
== retval::CATCH_OK);
|
||||||
|
|
||||||
SECTION("Basic Tests") {
|
SECTION("Basic Tests") {
|
||||||
// very basic test.
|
/* very basic test. */
|
||||||
lp_var_t<uint8_t> testVariable = lp_var_t<uint8_t>(
|
lp_var_t<uint8_t> testVariable = lp_var_t<uint8_t>(
|
||||||
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
||||||
REQUIRE(testVariable.read() == retval::CATCH_OK);
|
REQUIRE(testVariable.read() == retval::CATCH_OK);
|
||||||
@ -77,7 +77,7 @@ TEST_CASE("LocalPoolVariable" , "[LocPoolVarTest]") {
|
|||||||
|
|
||||||
SECTION("ErrorHandling") {
|
SECTION("ErrorHandling") {
|
||||||
|
|
||||||
// not try to use a local pool variable which does not exist
|
/* now try to use a local pool variable which does not exist */
|
||||||
lp_var_t<uint8_t> invalidVariable = lp_var_t<uint8_t>(
|
lp_var_t<uint8_t> invalidVariable = lp_var_t<uint8_t>(
|
||||||
objects::TEST_LOCAL_POOL_OWNER_BASE, 0xffffffff);
|
objects::TEST_LOCAL_POOL_OWNER_BASE, 0xffffffff);
|
||||||
REQUIRE(invalidVariable.read() ==
|
REQUIRE(invalidVariable.read() ==
|
||||||
@ -85,7 +85,7 @@ TEST_CASE("LocalPoolVariable" , "[LocPoolVarTest]") {
|
|||||||
|
|
||||||
REQUIRE(invalidVariable.commit() ==
|
REQUIRE(invalidVariable.commit() ==
|
||||||
static_cast<int>(localpool::POOL_ENTRY_NOT_FOUND));
|
static_cast<int>(localpool::POOL_ENTRY_NOT_FOUND));
|
||||||
// now try to access with wrong type
|
/* now try to access with wrong type */
|
||||||
lp_var_t<int8_t> invalidVariable2 = lp_var_t<int8_t>(
|
lp_var_t<int8_t> invalidVariable2 = lp_var_t<int8_t>(
|
||||||
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
||||||
REQUIRE(invalidVariable2.read() ==
|
REQUIRE(invalidVariable2.read() ==
|
||||||
@ -108,7 +108,7 @@ TEST_CASE("LocalPoolVariable" , "[LocPoolVarTest]") {
|
|||||||
sif::info << "LocalPoolVariable printout: " <<uint32tVar << std::endl;
|
sif::info << "LocalPoolVariable printout: " <<uint32tVar << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// for code coverage. If program does not crash -> OK
|
/* for code coverage. If program does not crash -> OK */
|
||||||
lp_var_t<uint8_t> invalidObjectVar = lp_var_t<uint8_t>(
|
lp_var_t<uint8_t> invalidObjectVar = lp_var_t<uint8_t>(
|
||||||
0xffffffff, lpool::uint8VarId);
|
0xffffffff, lpool::uint8VarId);
|
||||||
gp_id_t globPoolId(0xffffffff,
|
gp_id_t globPoolId(0xffffffff,
|
||||||
|
@ -35,13 +35,13 @@ TEST_CASE("LocalPoolVector" , "[LocPoolVecTest]") {
|
|||||||
|
|
||||||
CHECK(testVector[0] == 5);
|
CHECK(testVector[0] == 5);
|
||||||
|
|
||||||
// This is invalid access, so the last value will be set instead.
|
/* This is invalid access, so the last value will be set instead.
|
||||||
// (we can't throw exceptions)
|
(we can't throw exceptions) */
|
||||||
testVector[4] = 12;
|
testVector[4] = 12;
|
||||||
CHECK(testVector[2] == 12);
|
CHECK(testVector[2] == 12);
|
||||||
CHECK(testVector.commit() == retval::CATCH_OK);
|
CHECK(testVector.commit() == retval::CATCH_OK);
|
||||||
|
|
||||||
// Use read-only reference.
|
/* Use read-only reference. */
|
||||||
const lp_vec_t<uint16_t, 3>& roTestVec = testVector;
|
const lp_vec_t<uint16_t, 3>& roTestVec = testVector;
|
||||||
uint16_t valueOne = roTestVec[0];
|
uint16_t valueOne = roTestVec[0];
|
||||||
CHECK(valueOne == 5);
|
CHECK(valueOne == 5);
|
||||||
@ -87,7 +87,7 @@ TEST_CASE("LocalPoolVector" , "[LocPoolVecTest]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("ErrorHandling") {
|
SECTION("ErrorHandling") {
|
||||||
// not try to use a local pool variable which does not exist
|
/* Now try to use a local pool variable which does not exist */
|
||||||
lp_vec_t<uint16_t, 3> invalidVector = lp_vec_t<uint16_t, 3>(
|
lp_vec_t<uint16_t, 3> invalidVector = lp_vec_t<uint16_t, 3>(
|
||||||
objects::TEST_LOCAL_POOL_OWNER_BASE, 0xffffffff);
|
objects::TEST_LOCAL_POOL_OWNER_BASE, 0xffffffff);
|
||||||
REQUIRE(invalidVector.read() ==
|
REQUIRE(invalidVector.read() ==
|
||||||
@ -95,7 +95,7 @@ TEST_CASE("LocalPoolVector" , "[LocPoolVecTest]") {
|
|||||||
REQUIRE(invalidVector.commit() ==
|
REQUIRE(invalidVector.commit() ==
|
||||||
static_cast<int>(localpool::POOL_ENTRY_NOT_FOUND));
|
static_cast<int>(localpool::POOL_ENTRY_NOT_FOUND));
|
||||||
|
|
||||||
// now try to access with wrong type
|
/* Now try to access with wrong type */
|
||||||
lp_vec_t<uint32_t, 3> invalidVector2 = lp_vec_t<uint32_t, 3>(
|
lp_vec_t<uint32_t, 3> invalidVector2 = lp_vec_t<uint32_t, 3>(
|
||||||
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id);
|
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id);
|
||||||
REQUIRE(invalidVector2.read() ==
|
REQUIRE(invalidVector2.read() ==
|
||||||
|
Loading…
Reference in New Issue
Block a user