Vince Woo 48e4720419
Created new SerialBufferBase as a parent of SerializeBufferBase (now renamed LinearBufferBase). (#4288)
* Created new SerialBufferBase as a parent of SerializeBufferBase. Renaming interface functions to be less confusing.

* Deprecating copyRawOffset. No direct use-cases in F' core.

* Make SerialBufferBase a true pure virtual interface.

* Changing Serializable to work with SerialBufferBase parent interface.

* Changing copyRaw and copyRawOffset to work with SerialBufferBase

* Updating documentation for SerialBufferBase usage

* Adding some documentation. Adding missing ASSERT in copyRaw. Fixing some bugs that new ASSERT uncovered.

* Renaming SerializeBufferBase to LinearBufferBase. Add a using declaration to maintain backwards compatability. Properly mark LinearBufferBase functions as override.

* Filling in the rest of the docstrings for the classes in Serializable

* Removing redundant virtual keyword on override function

* Applying clang formatting

* Incorporating PR comments

* Fix compile issues

* Bump version to alpha

* Format

* v

---------

Co-authored-by: M Starch <LeStarch@googlemail.com>
2025-11-06 16:23:20 -08:00

73 lines
2.9 KiB
C++

// ======================================================================
// \title NestedTester.cpp
// \author bocchino
// \brief cpp file for NestedTester component implementation class
// ======================================================================
#include <gtest/gtest.h>
#include "FppTest/state_machine/internal_instance/initial/NestedTester.hpp"
namespace FppTest {
namespace SmInstanceInitial {
// ----------------------------------------------------------------------
// Component construction and destruction
// ----------------------------------------------------------------------
NestedTester::NestedTester(const char* const compName)
: NestedComponentBase(compName), m_nested_action_a_history(), m_smInitialNested_action_a_history() {}
NestedTester::~NestedTester() {}
// ----------------------------------------------------------------------
// Implementations for internal state machine actions
// ----------------------------------------------------------------------
void NestedTester::FppTest_SmInitial_Nested_action_a(SmId smId, FppTest_SmInitial_Nested::Signal signal) {
ASSERT_EQ(smId, SmId::smInitialNested);
this->m_smInitialNested_action_a_history.push(signal);
}
void NestedTester::FppTest_SmInstanceInitial_Nested_Nested_action_a(
SmId smId,
FppTest_SmInstanceInitial_Nested_Nested::Signal signal) {
ASSERT_EQ(smId, SmId::nested);
this->m_nested_action_a_history.push(signal);
}
// ----------------------------------------------------------------------
// Overflow hook implementations for internal state machines
// ----------------------------------------------------------------------
void NestedTester ::smInitialNested_stateMachineOverflowHook(SmId smId,
FwEnumStoreType signal,
Fw::SerialBufferBase& buffer) {
// Nothing to do
}
// ----------------------------------------------------------------------
// Tests
// ----------------------------------------------------------------------
void NestedTester::test() {
this->m_nested_action_a_history.clear();
this->m_smInitialNested_action_a_history.clear();
this->init(queueDepth, instanceId);
ASSERT_EQ(this->nested_getState(), Nested_Nested::State::S_T);
ASSERT_EQ(this->smInitialNested_getState(), SmInitial_Nested::State::S_T);
const FwIndexType expectedActionSize = 6;
ASSERT_EQ(this->m_nested_action_a_history.getSize(), expectedActionSize);
ASSERT_EQ(this->m_smInitialNested_action_a_history.getSize(), expectedActionSize);
for (FwIndexType i = 0; i < expectedActionSize; i++) {
ASSERT_EQ(this->m_nested_action_a_history.getItemAt(i), Nested_Nested::Signal::__FPRIME_AC_INITIAL_TRANSITION);
ASSERT_EQ(this->m_smInitialNested_action_a_history.getItemAt(i),
SmInitial_Nested::Signal::__FPRIME_AC_INITIAL_TRANSITION);
}
}
} // namespace SmInstanceInitial
} // namespace FppTest