|
15 | 15 | #include "FppTest/component/tests/EventTests.hpp" |
16 | 16 | #include "FppTest/component/tests/InternalInterfaceTests.hpp" |
17 | 17 | #include "FppTest/component/tests/ParamTests.hpp" |
| 18 | +#include "FppTest/component/tests/ExternalParamTests.hpp" |
18 | 19 | #include "FppTest/component/tests/PortTests.hpp" |
19 | 20 | #include "FppTest/component/tests/TlmTests.hpp" |
20 | 21 | #include "FppTest/component/types/FormalParamTypes.hpp" |
@@ -59,6 +60,9 @@ class Tester : public ActiveTestGTestBase { |
59 | 60 | void testParam(); |
60 | 61 | PARAM_CMD_TEST_DECLS |
61 | 62 |
|
| 63 | + void testExternalParam(); |
| 64 | + EXTERNAL_PARAM_CMD_TEST_DECLS |
| 65 | + |
62 | 66 | INTERNAL_INT_TEST_DECLS |
63 | 67 |
|
64 | 68 | void testTime(); |
@@ -164,8 +168,91 @@ class Tester : public ActiveTestGTestBase { |
164 | 168 | FppTest::Types::StructParam structPrm; |
165 | 169 | Fw::ParamValid prmValid; |
166 | 170 |
|
167 | | - // Time test values |
168 | 171 | Fw::Time time; |
| 172 | + |
| 173 | + //! External Parameter Delegate |
| 174 | + class ActiveTestComponentBaseParamExternalDelegate : |
| 175 | + public Fw::ParamExternalDelegate |
| 176 | + { |
| 177 | + |
| 178 | + public: |
| 179 | + |
| 180 | + // ---------------------------------------------------------------------- |
| 181 | + // Parameter validity flags |
| 182 | + // ---------------------------------------------------------------------- |
| 183 | + |
| 184 | + //! True if ParamBoolExternal was successfully received |
| 185 | + Fw::ParamValid m_param_ParamBoolExternal_valid; |
| 186 | + |
| 187 | + //! True if ParamI32External was successfully received |
| 188 | + Fw::ParamValid m_param_ParamI32External_valid; |
| 189 | + |
| 190 | + //! True if ParamStringExternal was successfully received |
| 191 | + Fw::ParamValid m_param_ParamStringExternal_valid; |
| 192 | + |
| 193 | + //! True if ParamEnumExternal was successfully received |
| 194 | + Fw::ParamValid m_param_ParamEnumExternal_valid; |
| 195 | + |
| 196 | + //! True if ParamArrayExternal was successfully received |
| 197 | + Fw::ParamValid m_param_ParamArrayExternal_valid; |
| 198 | + |
| 199 | + //! True if ParamStructExternal was successfully received |
| 200 | + Fw::ParamValid m_param_ParamStructExternal_valid; |
| 201 | + |
| 202 | + public: |
| 203 | + |
| 204 | + // ---------------------------------------------------------------------- |
| 205 | + // Parameter variables |
| 206 | + // ---------------------------------------------------------------------- |
| 207 | + |
| 208 | + //! Parameter ParamBoolExternal |
| 209 | + bool m_param_ParamBoolExternal; |
| 210 | + |
| 211 | + //! Parameter ParamI32External |
| 212 | + I32 m_param_ParamI32External; |
| 213 | + |
| 214 | + //! Parameter ParamStringExternal |
| 215 | + Fw::ParamString m_param_ParamStringExternal; |
| 216 | + |
| 217 | + //! Parameter ParamEnumExternal |
| 218 | + FormalParamEnum m_param_ParamEnumExternal; |
| 219 | + |
| 220 | + //! Parameter ParamArrayExternal |
| 221 | + FormalParamArray m_param_ParamArrayExternal; |
| 222 | + |
| 223 | + //! Parameter ParamStructExternal |
| 224 | + FormalParamStruct m_param_ParamStructExternal; |
| 225 | + |
| 226 | + public: |
| 227 | + |
| 228 | + // ---------------------------------------------------------------------- |
| 229 | + // Unit test implementation of external parameter delegate serialization/deserialization |
| 230 | + // ---------------------------------------------------------------------- |
| 231 | + |
| 232 | + //! Parameter deserialization function for external parameter unit testing |
| 233 | + Fw::SerializeStatus deserializeParam( |
| 234 | + const FwPrmIdType base_id, //!< The component base parameter ID to deserialize |
| 235 | + const FwPrmIdType local_id, //!< The parameter local ID to deserialize |
| 236 | + const Fw::ParamValid prmStat, //!< The parameter validity status |
| 237 | + Fw::SerializeBufferBase& buff //!< The buffer containing the parameter to deserialize |
| 238 | + ) override; |
| 239 | + |
| 240 | + //! Parameter serialization function for external parameter unit testing |
| 241 | + Fw::SerializeStatus serializeParam( |
| 242 | + const FwPrmIdType base_id, //!< The component base parameter ID to serialize |
| 243 | + const FwPrmIdType local_id, //!< The parameter local ID to serialize |
| 244 | + Fw::SerializeBufferBase& buff //!< The buffer to serialize the parameter into |
| 245 | + ) const override; |
| 246 | + |
| 247 | + }; |
| 248 | + |
| 249 | + // ---------------------------------------------------------------------- |
| 250 | + // Parameter delegates |
| 251 | + // ---------------------------------------------------------------------- |
| 252 | + |
| 253 | + //! Delegate to serialize/deserialize an externally stored parameter |
| 254 | + ActiveTestComponentBaseParamExternalDelegate paramTesterDelegate; |
| 255 | + |
169 | 256 | }; |
170 | 257 |
|
171 | 258 | #endif |
0 commit comments