1
0
forked from fsfw/fsfw

merge retval refactoring

This commit is contained in:
2022-08-16 01:08:26 +02:00
parent 9e064fe800
commit 1037102349
369 changed files with 2661 additions and 2668 deletions

View File

@ -7,26 +7,28 @@
#include "mocks/LocalPoolOwnerBase.h"
#include "tests/TestsConfig.h"
using namespace returnvalue;
TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
auto queue = MessageQueueMock(1);
LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
REQUIRE(poolOwner.initializeHkManager() == result::OK);
REQUIRE(poolOwner.initializeHkManagerAfterTaskCreation() == result::OK);
REQUIRE(poolOwner.initializeHkManager() == OK);
REQUIRE(poolOwner.initializeHkManagerAfterTaskCreation() == OK);
SECTION("Basic Tests") {
/* very basic test. */
lp_var_t<uint8_t> testVariable =
lp_var_t<uint8_t>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
REQUIRE(testVariable.read() == result::OK);
REQUIRE(testVariable.read() == returnvalue::OK);
CHECK(testVariable.value == 0);
testVariable.value = 5;
REQUIRE(testVariable.commit() == result::OK);
REQUIRE(testVariable.read() == result::OK);
REQUIRE(testVariable.commit() == returnvalue::OK);
REQUIRE(testVariable.read() == returnvalue::OK);
REQUIRE(testVariable.value == 5);
CHECK(not testVariable.isValid());
testVariable.setValid(true);
CHECK(testVariable.isValid());
CHECK(testVariable.commit(true) == result::OK);
CHECK(testVariable.commit(true) == returnvalue::OK);
testVariable.setReadWriteMode(pool_rwm_t::VAR_READ);
CHECK(testVariable.getReadWriteMode() == pool_rwm_t::VAR_READ);
@ -42,7 +44,7 @@ TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
gp_id_t globPoolId(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
lp_var_t<uint8_t> testVariable2 = lp_var_t<uint8_t>(globPoolId);
REQUIRE(testVariable2.read() == result::OK);
REQUIRE(testVariable2.read() == returnvalue::OK);
CHECK(testVariable2 == 5);
CHECK(testVariable == testVariable2);
testVariable = 10;
@ -54,12 +56,12 @@ TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
CHECK(maxSize == 1);
size_t serSize = 0;
CHECK(testVariable.serialize(&varPtr, &serSize, maxSize, SerializeIF::Endianness::MACHINE) ==
result::OK);
returnvalue::OK);
CHECK(variableRaw == 10);
const uint8_t* varConstPtr = &variableRaw;
testVariable = 5;
CHECK(testVariable.deSerialize(&varConstPtr, &serSize, SerializeIF::Endianness::MACHINE) ==
result::OK);
returnvalue::OK);
CHECK(testVariable == 10);
CHECK(testVariable != testVariable2);
CHECK(testVariable2 < testVariable);