mirror of
https://github.com/nasa/fprime.git
synced 2025-12-11 04:35:25 -06:00
* Add FppTestProject level * Fix FPP Test Project UT errors * Add back in FppTest deployment & make empty main in source.cpp * Remove Wold-style-cast to see if that fixes CI issues * Update add_compile_options --------- Co-authored-by: M Starch <LeStarch@googlemail.com>
297 lines
11 KiB
C++
297 lines
11 KiB
C++
// ======================================================================
|
|
// \title TesterHelpers.cpp
|
|
// \author T. Chieu
|
|
// \brief cpp file for tester helper functions
|
|
//
|
|
// \copyright
|
|
// Copyright (C) 2009-2023 California Institute of Technology.
|
|
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
|
// acknowledged.
|
|
//
|
|
// ======================================================================
|
|
|
|
#include "Tester.hpp"
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Helper methods
|
|
// ----------------------------------------------------------------------
|
|
|
|
void Tester ::connectPorts() {
|
|
// arrayArgsGuarded
|
|
for (FwIndexType i = 0; i < 2; ++i) {
|
|
this->connect_to_arrayArgsGuarded(i, this->component.get_arrayArgsGuarded_InputPort(i));
|
|
}
|
|
|
|
// arrayArgsSync
|
|
for (FwIndexType i = 0; i < 2; ++i) {
|
|
this->connect_to_arrayArgsSync(i, this->component.get_arrayArgsSync_InputPort(i));
|
|
}
|
|
|
|
// arrayReturnGuarded
|
|
this->connect_to_arrayReturnGuarded(0, this->component.get_arrayReturnGuarded_InputPort(0));
|
|
|
|
// arrayReturnSync
|
|
this->connect_to_arrayReturnSync(0, this->component.get_arrayReturnSync_InputPort(0));
|
|
|
|
// arrayStringAliasReturnGuarded
|
|
this->connect_to_arrayStringAliasReturnGuarded(0, this->component.get_arrayStringAliasReturnGuarded_InputPort(0));
|
|
|
|
// arrayStringAliasReturnSync
|
|
this->connect_to_arrayStringAliasReturnSync(0, this->component.get_arrayStringAliasReturnSync_InputPort(0));
|
|
|
|
// cmdIn
|
|
this->connect_to_cmdIn(0, this->component.get_cmdIn_InputPort(0));
|
|
|
|
// enumArgsGuarded
|
|
for (FwIndexType i = 0; i < 2; ++i) {
|
|
this->connect_to_enumArgsGuarded(i, this->component.get_enumArgsGuarded_InputPort(i));
|
|
}
|
|
|
|
// enumArgsSync
|
|
for (FwIndexType i = 0; i < 2; ++i) {
|
|
this->connect_to_enumArgsSync(i, this->component.get_enumArgsSync_InputPort(i));
|
|
}
|
|
|
|
// enumReturnGuarded
|
|
this->connect_to_enumReturnGuarded(0, this->component.get_enumReturnGuarded_InputPort(0));
|
|
|
|
// enumReturnSync
|
|
this->connect_to_enumReturnSync(0, this->component.get_enumReturnSync_InputPort(0));
|
|
|
|
// stringReturnGuarded
|
|
this->connect_to_stringReturnGuarded(0, this->component.get_stringReturnGuarded_InputPort(0));
|
|
|
|
// stringAliasReturnSync
|
|
this->connect_to_stringAliasReturnSync(0, this->component.get_stringAliasReturnSync_InputPort(0));
|
|
|
|
// stringAliasReturnGuarded
|
|
this->connect_to_stringAliasReturnGuarded(0, this->component.get_stringAliasReturnGuarded_InputPort(0));
|
|
|
|
// stringReturnSync
|
|
this->connect_to_stringReturnSync(0, this->component.get_stringReturnSync_InputPort(0));
|
|
|
|
// noArgsGuarded
|
|
for (FwIndexType i = 0; i < 2; ++i) {
|
|
this->connect_to_noArgsGuarded(i, this->component.get_noArgsGuarded_InputPort(i));
|
|
}
|
|
|
|
// noArgsReturnGuarded
|
|
this->connect_to_noArgsReturnGuarded(0, this->component.get_noArgsReturnGuarded_InputPort(0));
|
|
|
|
// noArgsReturnSync
|
|
this->connect_to_noArgsReturnSync(0, this->component.get_noArgsReturnSync_InputPort(0));
|
|
|
|
// noArgsSync
|
|
for (FwIndexType i = 0; i < 2; ++i) {
|
|
this->connect_to_noArgsSync(i, this->component.get_noArgsSync_InputPort(i));
|
|
}
|
|
|
|
// primitiveArgsGuarded
|
|
for (FwIndexType i = 0; i < 2; ++i) {
|
|
this->connect_to_primitiveArgsGuarded(i, this->component.get_primitiveArgsGuarded_InputPort(i));
|
|
}
|
|
|
|
// primitiveArgsSync
|
|
for (FwIndexType i = 0; i < 2; ++i) {
|
|
this->connect_to_primitiveArgsSync(i, this->component.get_primitiveArgsSync_InputPort(i));
|
|
}
|
|
|
|
// primitiveReturnGuarded
|
|
this->connect_to_primitiveReturnGuarded(0, this->component.get_primitiveReturnGuarded_InputPort(0));
|
|
|
|
// primitiveReturnSync
|
|
this->connect_to_primitiveReturnSync(0, this->component.get_primitiveReturnSync_InputPort(0));
|
|
|
|
// stringArgsGuarded
|
|
for (FwIndexType i = 0; i < 2; ++i) {
|
|
this->connect_to_stringArgsGuarded(i, this->component.get_stringArgsGuarded_InputPort(i));
|
|
}
|
|
|
|
// stringArgsSync
|
|
for (FwIndexType i = 0; i < 2; ++i) {
|
|
this->connect_to_stringArgsSync(i, this->component.get_stringArgsSync_InputPort(i));
|
|
}
|
|
|
|
// structArgsGuarded
|
|
for (FwIndexType i = 0; i < 2; ++i) {
|
|
this->connect_to_structArgsGuarded(i, this->component.get_structArgsGuarded_InputPort(i));
|
|
}
|
|
|
|
// structArgsSync
|
|
for (FwIndexType i = 0; i < 2; ++i) {
|
|
this->connect_to_structArgsSync(i, this->component.get_structArgsSync_InputPort(i));
|
|
}
|
|
|
|
// structReturnGuarded
|
|
this->connect_to_structReturnGuarded(0, this->component.get_structReturnGuarded_InputPort(0));
|
|
|
|
// structReturnSync
|
|
this->connect_to_structReturnSync(0, this->component.get_structReturnSync_InputPort(0));
|
|
|
|
// arrayArgsOut
|
|
this->component.set_arrayArgsOut_OutputPort(TypedPortIndex::TYPED,
|
|
this->get_from_arrayArgsOut(TypedPortIndex::TYPED));
|
|
|
|
// arrayReturnOut
|
|
this->component.set_arrayReturnOut_OutputPort(0, this->get_from_arrayReturnOut(0));
|
|
|
|
// arrayStringAliasReturnOut
|
|
this->component.set_arrayStringAliasReturnOut_OutputPort(0, this->get_from_arrayStringAliasReturnOut(0));
|
|
|
|
// cmdRegOut
|
|
this->component.set_cmdRegOut_OutputPort(0, this->get_from_cmdRegOut(0));
|
|
|
|
// cmdResponseOut
|
|
this->component.set_cmdResponseOut_OutputPort(0, this->get_from_cmdResponseOut(0));
|
|
|
|
// enumArgsOut
|
|
this->component.set_enumArgsOut_OutputPort(TypedPortIndex::TYPED,
|
|
this->get_from_enumArgsOut(TypedPortIndex::TYPED));
|
|
|
|
// enumReturnOut
|
|
this->component.set_enumReturnOut_OutputPort(0, this->get_from_enumReturnOut(0));
|
|
|
|
// stringReturnOut
|
|
this->component.set_stringReturnOut_OutputPort(0, this->get_from_stringReturnOut(0));
|
|
|
|
// stringAliasReturnOut
|
|
this->component.set_stringAliasReturnOut_OutputPort(0, this->get_from_stringAliasReturnOut(0));
|
|
|
|
// eventOut
|
|
this->component.set_eventOut_OutputPort(0, this->get_from_eventOut(0));
|
|
|
|
// noArgsOut
|
|
this->component.set_noArgsOut_OutputPort(TypedPortIndex::TYPED, this->get_from_noArgsOut(TypedPortIndex::TYPED));
|
|
|
|
// noArgsReturnOut
|
|
this->component.set_noArgsReturnOut_OutputPort(0, this->get_from_noArgsReturnOut(0));
|
|
|
|
// primitiveArgsOut
|
|
this->component.set_primitiveArgsOut_OutputPort(TypedPortIndex::TYPED,
|
|
this->get_from_primitiveArgsOut(TypedPortIndex::TYPED));
|
|
|
|
// primitiveReturnOut
|
|
this->component.set_primitiveReturnOut_OutputPort(0, this->get_from_primitiveReturnOut(0));
|
|
|
|
// stringArgsOut
|
|
this->component.set_stringArgsOut_OutputPort(TypedPortIndex::TYPED,
|
|
this->get_from_stringArgsOut(TypedPortIndex::TYPED));
|
|
|
|
// structArgsOut
|
|
this->component.set_structArgsOut_OutputPort(TypedPortIndex::TYPED,
|
|
this->get_from_structArgsOut(TypedPortIndex::TYPED));
|
|
|
|
// structReturnOut
|
|
this->component.set_structReturnOut_OutputPort(0, this->get_from_structReturnOut(0));
|
|
|
|
// textEventOut
|
|
this->component.set_textEventOut_OutputPort(0, this->get_from_textEventOut(0));
|
|
|
|
// tlmOut
|
|
this->component.set_tlmOut_OutputPort(0, this->get_from_tlmOut(0));
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Connect special ports
|
|
// ----------------------------------------------------------------------
|
|
|
|
// prmGetOut
|
|
this->component.set_prmGetOut_OutputPort(0, this->get_from_prmGetIn(0));
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Connect serial output ports
|
|
// ----------------------------------------------------------------------
|
|
|
|
this->component.set_noArgsOut_OutputPort(TypedPortIndex::SERIAL,
|
|
this->get_from_serialOut(SerialPortIndex::NO_ARGS));
|
|
|
|
this->component.set_primitiveArgsOut_OutputPort(TypedPortIndex::SERIAL,
|
|
this->get_from_serialOut(SerialPortIndex::PRIMITIVE));
|
|
|
|
this->component.set_stringArgsOut_OutputPort(TypedPortIndex::SERIAL,
|
|
this->get_from_serialOut(SerialPortIndex::STRING));
|
|
|
|
this->component.set_enumArgsOut_OutputPort(TypedPortIndex::SERIAL, this->get_from_serialOut(SerialPortIndex::ENUM));
|
|
|
|
this->component.set_arrayArgsOut_OutputPort(TypedPortIndex::SERIAL,
|
|
this->get_from_serialOut(SerialPortIndex::ARRAY));
|
|
|
|
this->component.set_structArgsOut_OutputPort(TypedPortIndex::SERIAL,
|
|
this->get_from_serialOut(SerialPortIndex::STRUCT));
|
|
|
|
this->component.set_serialOut_OutputPort(SerialPortIndex::NO_ARGS,
|
|
this->get_from_noArgsOut(TypedPortIndex::SERIAL));
|
|
|
|
this->component.set_serialOut_OutputPort(SerialPortIndex::PRIMITIVE,
|
|
this->get_from_primitiveArgsOut(TypedPortIndex::SERIAL));
|
|
|
|
this->component.set_serialOut_OutputPort(SerialPortIndex::STRING,
|
|
this->get_from_stringArgsOut(TypedPortIndex::SERIAL));
|
|
|
|
this->component.set_serialOut_OutputPort(SerialPortIndex::ENUM, this->get_from_enumArgsOut(TypedPortIndex::SERIAL));
|
|
|
|
this->component.set_serialOut_OutputPort(SerialPortIndex::ARRAY,
|
|
this->get_from_arrayArgsOut(TypedPortIndex::SERIAL));
|
|
|
|
this->component.set_serialOut_OutputPort(SerialPortIndex::STRUCT,
|
|
this->get_from_structArgsOut(TypedPortIndex::SERIAL));
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Connect serial input ports
|
|
// ----------------------------------------------------------------------
|
|
|
|
// serialGuarded
|
|
for (FwIndexType i = 0; i < 6; ++i) {
|
|
this->connect_to_serialGuarded(i, this->component.get_serialGuarded_InputPort(i));
|
|
}
|
|
|
|
// serialSync
|
|
for (FwIndexType i = 0; i < 6; ++i) {
|
|
this->connect_to_serialSync(i, this->component.get_serialSync_InputPort(i));
|
|
}
|
|
}
|
|
|
|
void Tester ::connectPrmSetIn() {
|
|
// prmSetOut
|
|
this->component.set_prmSetOut_OutputPort(0, this->get_from_prmSetIn(0));
|
|
}
|
|
|
|
void Tester ::connectTimeGetOut() {
|
|
// timeGetOut
|
|
this->component.set_timeGetOut_OutputPort(0, this->get_from_timeGetOut(0));
|
|
}
|
|
|
|
void Tester ::connectSpecialPortsSerial() {
|
|
// cmdResponseOut
|
|
this->component.set_cmdResponseOut_OutputPort(0, this->get_from_serialOut(0));
|
|
|
|
// cmdRegOut
|
|
this->component.set_cmdRegOut_OutputPort(0, this->get_from_serialOut(0));
|
|
|
|
// eventOut
|
|
this->component.set_eventOut_OutputPort(0, this->get_from_serialOut(0));
|
|
|
|
// textEventOut
|
|
this->component.set_textEventOut_OutputPort(0, this->get_from_serialOut(0));
|
|
|
|
// tlmOut
|
|
this->component.set_tlmOut_OutputPort(0, this->get_from_serialOut(0));
|
|
|
|
// prmSetOut
|
|
this->component.set_prmSetOut_OutputPort(0, this->get_from_serialOut(0));
|
|
|
|
// timeGetOut
|
|
this->component.set_timeGetOut_OutputPort(0, this->get_from_serialOut(0));
|
|
}
|
|
|
|
void Tester ::setPrmValid(Fw::ParamValid valid) {
|
|
this->prmValid = valid;
|
|
}
|
|
|
|
void Tester ::checkSerializeStatusSuccess() {
|
|
ASSERT_EQ(component.serializeStatus, Fw::FW_SERIALIZE_OK);
|
|
}
|
|
|
|
void Tester ::checkSerializeStatusBufferEmpty() {
|
|
ASSERT_EQ(component.serializeStatus, Fw::FW_DESERIALIZE_BUFFER_EMPTY);
|
|
}
|