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.
3
3
// / @ingroup
4
4
// / @cond
5
5
// /***************************************************************************
22
22
// /***************************************************************************
23
23
// / @endcond
24
24
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
27
27
28
28
#include < chrono>
29
29
#include " qpcpp.hpp"
@@ -62,6 +62,8 @@ void Setup(enum_t maxPubSubSignalValue, uint32_t ticksPerSecond,
62
62
const MemPoolConfigs& pubSubEventMemPoolConfigs = {},
63
63
MemPoolTeardownOption memPoolOpt = MemPoolTeardownOption::CHECK_FOR_LEAKS);
64
64
65
+ void ChangeMemPoolTeardownOption (MemPoolTeardownOption memPoolOpt);
66
+
65
67
// / Teardown the QP/QF subsystem after completing a unit test.
66
68
void Teardown ();
67
69
@@ -95,6 +97,27 @@ void PublishAndProcess(enum_t sig,
95
97
void PublishAndProcess (QP::QEvt const * e,
96
98
PublishedEventRecorder* recorder = nullptr );
97
99
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
+
98
121
// / Get the internal library version string.
99
122
// / Uses semantic versioning.
100
123
const char * GetVersion ();
@@ -103,4 +126,4 @@ const char * GetVersion();
103
126
} // namespace test
104
127
} // namespace cms
105
128
106
- #endif // CPPUTEST_FOR_QPCPP_CMS_CPPUTEST_QF_CTRL_HPP
129
+ #endif // CMS_CPPUTEST_QF_CTRL_HPP
0 commit comments