fprime/Fw/Test/UnitTestAssert.hpp
M Starch ec08d43dd3
Removes NATIVE_INT_TYPE, NATIVE_UINT_TYPE, and POINTER_CAST from Fw (#3286)
* NATIVE_INT_TYPE use in toString

* NATIVE_INT_TYPE use in SimpleObjRegistry

* NATIVE_INT_TYPE use in Asserts

* NATIVE_INT_TYPE use in Fw/Comp

* NATIVE_INT_TYPE use in getCapacity

* NATIVE_INT_TYPE use in getEntries

* NATIVE_INT_TYPE use in size/length

* NATIVE_INT_TYPE use in FILE_NAME_ARG

* NATIVE_INT_TYPE use in Fw (misc)

* NATIVE_INT_TYPE use in identifier

* NATIVE_INT_TYPE use in Fw (misc II)

* POINTER_CAST in Buffer

* POINTER_CAST in Serializable

* sp

* Removing no longer used DefaultTypes.hpp

* Fixes to accomidate Fw refactor

* Unit-test and CI fixes

* Fixing review comments - pt 1
2025-03-04 14:42:48 -08:00

82 lines
2.2 KiB
C++

/*
* UnitTestAssert.hpp
*
* Created on: Feb 8, 2016
* Author: tcanham
* Revised July 2020
* Author: bocchino
*/
#ifndef TEST_UNITTESTASSERT_HPP_
#define TEST_UNITTESTASSERT_HPP_
#include <Fw/Test/String.hpp>
#include <Fw/Types/Assert.hpp>
namespace Test {
class UnitTestAssert: public Fw::AssertHook {
public:
#if FW_ASSERT_LEVEL == FW_FILEID_ASSERT
typedef U32 File;
#else
typedef String File;
#endif
// initial value for File
static const File fileInit;
public:
UnitTestAssert();
virtual ~UnitTestAssert();
// function for hook
void doAssert();
void reportAssert(
FILE_NAME_ARG file,
FwSizeType lineNo,
FwSizeType numArgs,
FwAssertArgType arg1,
FwAssertArgType arg2,
FwAssertArgType arg3,
FwAssertArgType arg4,
FwAssertArgType arg5,
FwAssertArgType arg6
);
// retrieves assertion failure values
void retrieveAssert(
File& file,
FwSizeType& lineNo,
FwSizeType& numArgs,
FwAssertArgType& arg1,
FwAssertArgType& arg2,
FwAssertArgType& arg3,
FwAssertArgType& arg4,
FwAssertArgType& arg5,
FwAssertArgType& arg6
) const;
// check whether assertion failure occurred
bool assertFailed() const;
// clear assertion failure
void clearAssertFailure();
private:
File m_file;
FwSizeType m_lineNo;
FwSizeType m_numArgs;
FwAssertArgType m_arg1;
FwAssertArgType m_arg2;
FwAssertArgType m_arg3;
FwAssertArgType m_arg4;
FwAssertArgType m_arg5;
FwAssertArgType m_arg6;
// Whether an assertion failed
bool m_assertFailed;
};
} /* namespace Test */
#endif /* TEST_UNITTESTASSERT_HPP_ */