1- // / @brief Supporting methods for setup, teardown, of a fake cpputest
2- // / compatible port of the qpcpp QF framework.
1+ // / @brief Supporting methods for setup, teardown, and control of a fake
2+ // / cpputest compatible port of the QP/C++ (qpcpp) framework.
33// / @ingroup
44// / @cond
55// /***************************************************************************
2222// /***************************************************************************
2323// / @endcond
2424
25- #ifndef CPPUTEST_FOR_QPCPP_CMS_CPPUTEST_QF_CTRL_HPP
26- #define CPPUTEST_FOR_QPCPP_CMS_CPPUTEST_QF_CTRL_HPP
25+ #ifndef CMS_CPPUTEST_QF_CTRL_HPP
26+ #define CMS_CPPUTEST_QF_CTRL_HPP
2727
2828#include < chrono>
2929#include " qpcpp.hpp"
@@ -62,6 +62,8 @@ void Setup(enum_t maxPubSubSignalValue, uint32_t ticksPerSecond,
6262 const MemPoolConfigs& pubSubEventMemPoolConfigs = {},
6363 MemPoolTeardownOption memPoolOpt = MemPoolTeardownOption::CHECK_FOR_LEAKS);
6464
65+ void ChangeMemPoolTeardownOption (MemPoolTeardownOption memPoolOpt);
66+
6567// / Teardown the QP/QF subsystem after completing a unit test.
6668void Teardown ();
6769
@@ -95,6 +97,27 @@ void PublishAndProcess(enum_t sig,
9597void PublishAndProcess (QP::QEvt const * e,
9698 PublishedEventRecorder* recorder = nullptr );
9799
100+ // / Helper method to Post an event to an active object
101+ // / followed internally by ProcessEvents().
102+ // / \param e
103+ // / \param dest
104+ inline void PostAndProcess (QP::QEvt const * e, QP::QActive* dest)
105+ {
106+ dest->POST (e, nullptr );
107+ ProcessEvents ();
108+ }
109+
110+ // / Helper method to Post a static const QEvt to an active object
111+ // / followed internally by ProcessEvents().
112+ // / \param sig (template param): the signal value of the const event to post
113+ // / \param dest : the active object to post to.
114+ template <enum_t sig>
115+ inline void PostAndProcess (QP::QActive* dest)
116+ {
117+ static const QP::QEvt constEvent = QP::QEvt (sig);
118+ PostAndProcess (&constEvent, dest);
119+ }
120+
98121// / Get the internal library version string.
99122// / Uses semantic versioning.
100123const char * GetVersion ();
@@ -103,4 +126,4 @@ const char * GetVersion();
103126} // namespace test
104127} // namespace cms
105128
106- #endif // CPPUTEST_FOR_QPCPP_CMS_CPPUTEST_QF_CTRL_HPP
129+ #endif // CMS_CPPUTEST_QF_CTRL_HPP
0 commit comments