Mishaal 9211a047e8
Updates for FPPTest corresponding to UT cmake update for protected/private (#3810)
* Updates for FppTest/dp and FppTest/component corresponding to UT cmake update for protected/private

* Refactor Fpp/state_machine/internal_instance/state teststo be in their own Tester classes

* Standardize headers

* Remove old ifndef from BasicGuardTester.hpp

* More cleanup of BasicGuardTester

* Remove extra /dp files (leftover from rename) and fix a header comment typo

* Revert accidentally checked in cmake

* Enable UT_AUTO_HELPERS for FppTest/dp

* Revert FppTest/state_machine/internal_instance/state

* Update state_machine/internal_instance/state/ component names to append Tester

* pdate state_machine/internal_instance/choice/ component names

* Update state_machine/internal_instance/initial/ component names

* Reformat code

---------

Co-authored-by: Rob Bocchino <bocchino@jpl.nasa.gov>
2025-07-18 09:36:46 -07:00

114 lines
4.1 KiB
C++

// ======================================================================
// \title BasicGuardTester.hpp
// \author bocchino
// \brief hpp file for BasicGuardTester component implementation class
// ======================================================================
#ifndef FppTest_SmInstanceState_BasicGuard_HPP
#define FppTest_SmInstanceState_BasicGuard_HPP
#include "FppTest/state_machine/internal/harness/Harness.hpp"
#include "FppTest/state_machine/internal_instance/state/BasicGuardComponentAc.hpp"
namespace FppTest {
namespace SmInstanceState {
class BasicGuardTester : public BasicGuardComponentBase {
private:
// ----------------------------------------------------------------------
// Constants
// ----------------------------------------------------------------------
//! The history size
static constexpr FwSizeType historySize = 10;
//! The queue depth
static constexpr FwSizeType queueDepth = 10;
//! The instance ID
static constexpr FwEnumStoreType instanceId = 0;
private:
// ----------------------------------------------------------------------
// Types
// ----------------------------------------------------------------------
//! The type FppTest_SmState_BasicGuard
using SmState_BasicGuard = FppTest_SmState_BasicGuard;
public:
// ----------------------------------------------------------------------
// Component construction and destruction
// ----------------------------------------------------------------------
//! Construct BasicGuard object
BasicGuardTester(const char* const compName //!< The component name
);
//! Destroy BasicGuard object
~BasicGuardTester();
private:
// ----------------------------------------------------------------------
// Implementations for internal state machine actions
// ----------------------------------------------------------------------
//! Implementation for action a of state machine FppTest_SmState_BasicGuard
//!
//! Action a
void FppTest_SmState_BasicGuard_action_a(SmId smId, //!< The state machine id
FppTest_SmState_BasicGuard::Signal signal //!< The signal
) override;
private:
// ----------------------------------------------------------------------
// Implementations for internal state machine guards
// ----------------------------------------------------------------------
//! Implementation for guard g of state machine FppTest_SmState_BasicGuard
//!
//! Guard g
bool FppTest_SmState_BasicGuard_guard_g(SmId smId, //!< The state machine id
FppTest_SmState_BasicGuard::Signal signal //!< The signal
) const override;
public:
// ----------------------------------------------------------------------
// Tests
// ----------------------------------------------------------------------
//! Test with true guard
void testTrue();
//! Test with false guard
void testFalse();
private:
// ----------------------------------------------------------------------
// Helper functions
// ----------------------------------------------------------------------
//! Helper function for checking actions and guards
void checkActionsAndGuards(FwIndexType expectedActionSize, //!< The expected action size
FwIndexType expectedGuardSize //!< The expected guard size
);
private:
// ----------------------------------------------------------------------
// Member variables
// ----------------------------------------------------------------------
//! The history associated with action a of smStateBasicGuard
SmHarness::History<SmState_BasicGuard::Signal, historySize> m_smStateBasicGuard_action_a_history;
//! The guard g of smStateBasicGuard
SmHarness::NoArgGuard<SmState_BasicGuard::Signal, historySize> m_smStateBasicGuard_guard_g;
};
} // namespace SmInstanceState
} // namespace FppTest
#endif