Skip to content

Commit

Permalink
Update unit tests for C++ port writer
Browse files Browse the repository at this point in the history
  • Loading branch information
tiffany1618 committed Jan 19, 2023
1 parent 15e3f2b commit 4b613dd
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 115 deletions.
28 changes: 13 additions & 15 deletions compiler/tools/fpp-to-cpp/test/port/AbsTypePortAc.ref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void InputAbsTypePort ::
CompFuncPtr funcPtr
)
{
FW_ASSERT(callComp);
FW_ASSERT(funcPtr);
FW_ASSERT(callComp != nullptr);
FW_ASSERT(funcPtr != nullptr);

this->m_comp = callComp;
this->m_func = funcPtr;
Expand All @@ -80,8 +80,8 @@ void InputAbsTypePort ::
this->trace();
#endif

FW_ASSERT(this->m_comp);
FW_ASSERT(this->m_func);
FW_ASSERT(this->m_comp != nullptr);
FW_ASSERT(this->m_func != nullptr);

return this->m_func(this->m_comp, this->m_portNum, t, tRef);
}
Expand All @@ -97,8 +97,8 @@ Fw::SerializeStatus InputAbsTypePort ::
this->trace();
#endif

FW_ASSERT(this->m_comp);
FW_ASSERT(this->m_func);
FW_ASSERT(this->m_comp != nullptr);
FW_ASSERT(this->m_func != nullptr);

T t;
_status = _buffer.deserialize(t);
Expand Down Expand Up @@ -140,7 +140,7 @@ void OutputAbsTypePort ::
void OutputAbsTypePort ::
addCallPort(InputAbsTypePort* callPort)
{
FW_ASSERT(callPort);
FW_ASSERT(callPort != nullptr);

this->m_port = callPort;
this->m_connObj = callPort;
Expand All @@ -161,14 +161,11 @@ void OutputAbsTypePort ::
#endif

#if FW_PORT_SERIALIZATION
FW_ASSERT(this->m_port || this->m_serPort);
#else
FW_ASSERT(this->m_port);
#endif
if (this->m_port) {
FW_ASSERT((this->m_port != nullptr) || (this->m_serPort != nullptr));

if (this->m_port != nullptr) {
this->m_port->invoke(t, tRef);
#if FW_PORT_SERIALIZATION
} else if (this->m_serPort) {
} else {
Fw::SerializeStatus _status;
AbsTypePortBuffer _buffer;

Expand All @@ -182,6 +179,7 @@ void OutputAbsTypePort ::
FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
}
#else
}
FW_ASSERT(this->m_port != nullptr);
this->m_port->invoke(t, tRef);
#endif
}
28 changes: 13 additions & 15 deletions compiler/tools/fpp-to-cpp/test/port/BuiltInTypePortAc.ref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void InputBuiltInTypePort ::
CompFuncPtr funcPtr
)
{
FW_ASSERT(callComp);
FW_ASSERT(funcPtr);
FW_ASSERT(callComp != nullptr);
FW_ASSERT(funcPtr != nullptr);

this->m_comp = callComp;
this->m_func = funcPtr;
Expand All @@ -80,8 +80,8 @@ void InputBuiltInTypePort ::
this->trace();
#endif

FW_ASSERT(this->m_comp);
FW_ASSERT(this->m_func);
FW_ASSERT(this->m_comp != nullptr);
FW_ASSERT(this->m_func != nullptr);

return this->m_func(this->m_comp, this->m_portNum, t, tRef);
}
Expand All @@ -97,8 +97,8 @@ Fw::SerializeStatus InputBuiltInTypePort ::
this->trace();
#endif

FW_ASSERT(this->m_comp);
FW_ASSERT(this->m_func);
FW_ASSERT(this->m_comp != nullptr);
FW_ASSERT(this->m_func != nullptr);

FwOpcodeType t;
_status = _buffer.deserialize(t);
Expand Down Expand Up @@ -140,7 +140,7 @@ void OutputBuiltInTypePort ::
void OutputBuiltInTypePort ::
addCallPort(InputBuiltInTypePort* callPort)
{
FW_ASSERT(callPort);
FW_ASSERT(callPort != nullptr);

this->m_port = callPort;
this->m_connObj = callPort;
Expand All @@ -161,14 +161,11 @@ void OutputBuiltInTypePort ::
#endif

#if FW_PORT_SERIALIZATION
FW_ASSERT(this->m_port || this->m_serPort);
#else
FW_ASSERT(this->m_port);
#endif
if (this->m_port) {
FW_ASSERT((this->m_port != nullptr) || (this->m_serPort != nullptr));

if (this->m_port != nullptr) {
this->m_port->invoke(t, tRef);
#if FW_PORT_SERIALIZATION
} else if (this->m_serPort) {
} else {
Fw::SerializeStatus _status;
BuiltInTypePortBuffer _buffer;

Expand All @@ -182,6 +179,7 @@ void OutputBuiltInTypePort ::
FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
}
#else
}
FW_ASSERT(this->m_port != nullptr);
this->m_port->invoke(t, tRef);
#endif
}
28 changes: 13 additions & 15 deletions compiler/tools/fpp-to-cpp/test/port/EmptyPortAc.ref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ void InputEmptyPort ::
CompFuncPtr funcPtr
)
{
FW_ASSERT(callComp);
FW_ASSERT(funcPtr);
FW_ASSERT(callComp != nullptr);
FW_ASSERT(funcPtr != nullptr);

this->m_comp = callComp;
this->m_func = funcPtr;
Expand All @@ -73,8 +73,8 @@ void InputEmptyPort ::
this->trace();
#endif

FW_ASSERT(this->m_comp);
FW_ASSERT(this->m_func);
FW_ASSERT(this->m_comp != nullptr);
FW_ASSERT(this->m_func != nullptr);

return this->m_func(this->m_comp, this->m_portNum);
}
Expand All @@ -90,8 +90,8 @@ Fw::SerializeStatus InputEmptyPort ::
this->trace();
#endif

FW_ASSERT(this->m_comp);
FW_ASSERT(this->m_func);
FW_ASSERT(this->m_comp != nullptr);
FW_ASSERT(this->m_func != nullptr);

this->m_func(this->m_comp, this->m_portNum);

Expand Down Expand Up @@ -121,7 +121,7 @@ void OutputEmptyPort ::
void OutputEmptyPort ::
addCallPort(InputEmptyPort* callPort)
{
FW_ASSERT(callPort);
FW_ASSERT(callPort != nullptr);

this->m_port = callPort;
this->m_connObj = callPort;
Expand All @@ -139,21 +139,19 @@ void OutputEmptyPort ::
#endif

#if FW_PORT_SERIALIZATION
FW_ASSERT(this->m_port || this->m_serPort);
#else
FW_ASSERT(this->m_port);
#endif
if (this->m_port) {
FW_ASSERT((this->m_port != nullptr) || (this->m_serPort != nullptr));

if (this->m_port != nullptr) {
this->m_port->invoke();
#if FW_PORT_SERIALIZATION
} else if (this->m_serPort) {
} else {
Fw::SerializeStatus _status;
EmptyPortBuffer _buffer;

_status = this->m_serPort->invokeSerial(_buffer);
FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
}
#else
}
FW_ASSERT(this->m_port != nullptr);
this->m_port->invoke();
#endif
}
28 changes: 13 additions & 15 deletions compiler/tools/fpp-to-cpp/test/port/FppTypePortAc.ref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void InputFppTypePort ::
CompFuncPtr funcPtr
)
{
FW_ASSERT(callComp);
FW_ASSERT(funcPtr);
FW_ASSERT(callComp != nullptr);
FW_ASSERT(funcPtr != nullptr);

this->m_comp = callComp;
this->m_func = funcPtr;
Expand All @@ -84,8 +84,8 @@ void InputFppTypePort ::
this->trace();
#endif

FW_ASSERT(this->m_comp);
FW_ASSERT(this->m_func);
FW_ASSERT(this->m_comp != nullptr);
FW_ASSERT(this->m_func != nullptr);

return this->m_func(this->m_comp, this->m_portNum, e, eRef, a, aRef, s, sRef);
}
Expand All @@ -101,8 +101,8 @@ Fw::SerializeStatus InputFppTypePort ::
this->trace();
#endif

FW_ASSERT(this->m_comp);
FW_ASSERT(this->m_func);
FW_ASSERT(this->m_comp != nullptr);
FW_ASSERT(this->m_func != nullptr);

E e;
_status = _buffer.deserialize(e);
Expand Down Expand Up @@ -168,7 +168,7 @@ void OutputFppTypePort ::
void OutputFppTypePort ::
addCallPort(InputFppTypePort* callPort)
{
FW_ASSERT(callPort);
FW_ASSERT(callPort != nullptr);

this->m_port = callPort;
this->m_connObj = callPort;
Expand All @@ -193,14 +193,11 @@ void OutputFppTypePort ::
#endif

#if FW_PORT_SERIALIZATION
FW_ASSERT(this->m_port || this->m_serPort);
#else
FW_ASSERT(this->m_port);
#endif
if (this->m_port) {
FW_ASSERT((this->m_port != nullptr) || (this->m_serPort != nullptr));

if (this->m_port != nullptr) {
this->m_port->invoke(e, eRef, a, aRef, s, sRef);
#if FW_PORT_SERIALIZATION
} else if (this->m_serPort) {
} else {
Fw::SerializeStatus _status;
FppTypePortBuffer _buffer;

Expand All @@ -226,6 +223,7 @@ void OutputFppTypePort ::
FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
}
#else
}
FW_ASSERT(this->m_port != nullptr);
this->m_port->invoke(e, eRef, a, aRef, s, sRef);
#endif
}
28 changes: 13 additions & 15 deletions compiler/tools/fpp-to-cpp/test/port/KwdNamePortAc.ref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void InputKwdNamePort ::
CompFuncPtr funcPtr
)
{
FW_ASSERT(callComp);
FW_ASSERT(funcPtr);
FW_ASSERT(callComp != nullptr);
FW_ASSERT(funcPtr != nullptr);

this->m_comp = callComp;
this->m_func = funcPtr;
Expand All @@ -77,8 +77,8 @@ void InputKwdNamePort ::
this->trace();
#endif

FW_ASSERT(this->m_comp);
FW_ASSERT(this->m_func);
FW_ASSERT(this->m_comp != nullptr);
FW_ASSERT(this->m_func != nullptr);

return this->m_func(this->m_comp, this->m_portNum, time);
}
Expand All @@ -94,8 +94,8 @@ Fw::SerializeStatus InputKwdNamePort ::
this->trace();
#endif

FW_ASSERT(this->m_comp);
FW_ASSERT(this->m_func);
FW_ASSERT(this->m_comp != nullptr);
FW_ASSERT(this->m_func != nullptr);

U32 time;
_status = _buffer.deserialize(time);
Expand Down Expand Up @@ -131,7 +131,7 @@ void OutputKwdNamePort ::
void OutputKwdNamePort ::
addCallPort(InputKwdNamePort* callPort)
{
FW_ASSERT(callPort);
FW_ASSERT(callPort != nullptr);

this->m_port = callPort;
this->m_connObj = callPort;
Expand All @@ -149,14 +149,11 @@ void OutputKwdNamePort ::
#endif

#if FW_PORT_SERIALIZATION
FW_ASSERT(this->m_port || this->m_serPort);
#else
FW_ASSERT(this->m_port);
#endif
if (this->m_port) {
FW_ASSERT((this->m_port != nullptr) || (this->m_serPort != nullptr));

if (this->m_port != nullptr) {
this->m_port->invoke(time);
#if FW_PORT_SERIALIZATION
} else if (this->m_serPort) {
} else {
Fw::SerializeStatus _status;
KwdNamePortBuffer _buffer;

Expand All @@ -167,6 +164,7 @@ void OutputKwdNamePort ::
FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
}
#else
}
FW_ASSERT(this->m_port != nullptr);
this->m_port->invoke(time);
#endif
}
Loading

0 comments on commit 4b613dd

Please sign in to comment.