continued tests
This commit is contained in:
parent
bd93392b59
commit
16458f6a1e
@ -46,7 +46,7 @@ inline ReturnValue_t LocalPoolVariable<T>::readWithoutLock() {
|
|||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "PoolPoolVariable: Read of local pool variable of object "
|
sif::error << "PoolPoolVariable: Read of local pool variable of object "
|
||||||
<< std::hex << std::setw(8) << std::setfill('0')
|
<< std::hex << std::setw(8) << std::setfill('0')
|
||||||
<< hkManager->getOwner() << " and lp ID " << localPoolId
|
<< hkManager->getOwner() << " and lp ID 0x" << localPoolId
|
||||||
<< std::dec << " failed." << std::setfill(' ') << std::endl;
|
<< std::dec << " failed." << std::setfill(' ') << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
@ -78,7 +78,7 @@ inline ReturnValue_t LocalPoolVariable<T>::commitWithoutLock() {
|
|||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "PoolPoolVariable: Read of local pool variable of "
|
sif::error << "PoolPoolVariable: Read of local pool variable of "
|
||||||
<< "object " << std::hex << std::setw(8) << std::setfill('0')
|
<< "object " << std::hex << std::setw(8) << std::setfill('0')
|
||||||
<< hkManager->getOwner() << " and lp ID " << localPoolId
|
<< hkManager->getOwner() << " and lp ID 0x" << localPoolId
|
||||||
<< std::dec << " failed." << std::endl;
|
<< std::dec << " failed." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
|
@ -33,7 +33,7 @@ template<typename T, uint16_t vectorSize>
|
|||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::readWithoutLock() {
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::readWithoutLock() {
|
||||||
if(readWriteMode == pool_rwm_t::VAR_WRITE) {
|
if(readWriteMode == pool_rwm_t::VAR_WRITE) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::debug << "LocalPoolVar: Invalid read write "
|
sif::warning << "LocalPoolVector: Invalid read write "
|
||||||
"mode for read() call." << std::endl;
|
"mode for read() call." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
||||||
@ -45,10 +45,10 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::readWithoutLock() {
|
|||||||
|
|
||||||
if(result != RETURN_OK) {
|
if(result != RETURN_OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "PoolVector: Read of local pool variable of object "
|
sif::error << "LocalPoolVector: Read of local pool variable of object "
|
||||||
"0x" << std::hex << std::setw(8) << std::setfill('0') <<
|
<< std::hex << std::setw(8) << std::setfill('0')
|
||||||
hkManager->getOwner() << "and lp ID 0x" << localPoolId <<
|
<< hkManager->getOwner() << "and lp ID 0x" << localPoolId
|
||||||
std::dec << " failed." << std::endl;
|
<< std::dec << " failed." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ template<typename T, uint16_t vectorSize>
|
|||||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::commitWithoutLock() {
|
inline ReturnValue_t LocalPoolVector<T, vectorSize>::commitWithoutLock() {
|
||||||
if(readWriteMode == pool_rwm_t::VAR_READ) {
|
if(readWriteMode == pool_rwm_t::VAR_READ) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::debug << "LocalPoolVar: Invalid read write "
|
sif::warning << "LocalPoolVector: Invalid read write "
|
||||||
"mode for commit() call." << std::endl;
|
"mode for commit() call." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
||||||
@ -78,10 +78,10 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::commitWithoutLock() {
|
|||||||
ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
||||||
if(result != RETURN_OK) {
|
if(result != RETURN_OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "PoolVector: Read of local pool variable of object "
|
sif::error << "LocalPoolVector: Read of local pool variable of object "
|
||||||
"0x" << std::hex << std::setw(8) << std::setfill('0') <<
|
<< std::hex << std::setw(8) << std::setfill('0')
|
||||||
hkManager->getOwner() << " and lp ID 0x" << localPoolId <<
|
<< hkManager->getOwner() << " and lp ID " << localPoolId
|
||||||
std::dec << " failed.\n" << std::flush;
|
<< std::dec << " failed." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,23 @@ TEST_CASE("LocalPoolVariable" , "[LocPoolVarTest]") {
|
|||||||
testVariable.setValid(true);
|
testVariable.setValid(true);
|
||||||
CHECK(testVariable.isValid());
|
CHECK(testVariable.isValid());
|
||||||
|
|
||||||
|
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(testVariable.read() == retval::CATCH_OK);
|
||||||
|
REQUIRE(testVariable == 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("ErrorHandling") {
|
||||||
|
|
||||||
// not try to use a local pool variable which does not exist
|
// not 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() ==
|
||||||
static_cast<int>(HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND));
|
static_cast<int>(HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND));
|
||||||
|
|
||||||
|
REQUIRE(invalidVariable.commit() ==
|
||||||
|
static_cast<int>(HasLocalDataPoolIF::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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user