@@ -206,75 +206,54 @@ void GenericHubTester ::send_from_driver_packet(U32 type,
206206 this ->invoke_to_fromBufferDriver (0 , buffer);
207207}
208208
209- void GenericHubTester ::test_invalid_deserialization_paths () {
210- // Header too short to deserialize
211- clearFromPortHistory ();
212- Fw::Buffer shortBuffer (m_data_for_allocation, sizeof (U32) + sizeof (U32) + sizeof (FwBuffSizeType) - 1 );
213- this ->invoke_to_fromBufferDriver (0 , shortBuffer);
214- ASSERT_from_fromBufferDriverReturn_SIZE (1 );
209+ void GenericHubTester ::assert_no_outputs_sent () {
215210 ASSERT_EQ (m_comm_out, 0U );
216211 ASSERT_from_bufferOut_SIZE (0 );
217212 ASSERT_from_eventOut_SIZE (0 );
218213 ASSERT_from_tlmOut_SIZE (0 );
219214 ASSERT_from_cmdDispOut_SIZE (0 );
220215 ASSERT_from_cmdRespOut_SIZE (0 );
216+ }
217+
218+ void GenericHubTester ::test_invalid_deserialization_paths () {
219+ // Header too short to deserialize
220+ clearFromPortHistory ();
221+ Fw::Buffer shortBuffer (m_data_for_allocation, sizeof (U32) + sizeof (U32) + sizeof (FwBuffSizeType) - 1 );
222+ this ->invoke_to_fromBufferDriver (0 , shortBuffer);
223+ ASSERT_from_fromBufferDriverReturn_SIZE (1 );
224+ this ->assert_no_outputs_sent ();
221225
222226 // Invalid type should be dropped
223227 clearFromPortHistory ();
224228 this ->send_from_driver_packet (static_cast <U32>(GenericHub::HUB_TYPE_MAX), 0 , 0 , nullptr , 0 );
225229 ASSERT_from_fromBufferDriverReturn_SIZE (1 );
226- ASSERT_EQ (m_comm_out, 0U );
227- ASSERT_from_bufferOut_SIZE (0 );
228- ASSERT_from_eventOut_SIZE (0 );
229- ASSERT_from_tlmOut_SIZE (0 );
230- ASSERT_from_cmdDispOut_SIZE (0 );
231- ASSERT_from_cmdRespOut_SIZE (0 );
230+ this ->assert_no_outputs_sent ();
232231
233232 // Declared payload size mismatch should be dropped
234233 clearFromPortHistory ();
235234 this ->send_from_driver_packet (static_cast <U32>(GenericHub::HUB_TYPE_PORT), 0 , 1 , nullptr , 0 );
236235 ASSERT_from_fromBufferDriverReturn_SIZE (1 );
237- ASSERT_EQ (m_comm_out, 0U );
238- ASSERT_from_bufferOut_SIZE (0 );
239- ASSERT_from_eventOut_SIZE (0 );
240- ASSERT_from_tlmOut_SIZE (0 );
241- ASSERT_from_cmdDispOut_SIZE (0 );
242- ASSERT_from_cmdRespOut_SIZE (0 );
236+ this ->assert_no_outputs_sent ();
243237
244238 // Invalid serialOut destination port should not invoke output
245239 clearFromPortHistory ();
246240 this ->send_from_driver_packet (static_cast <U32>(GenericHub::HUB_TYPE_PORT),
247241 this ->componentOut .getNum_serialOut_OutputPorts (), 0 , nullptr , 0 );
248242 ASSERT_from_fromBufferDriverReturn_SIZE (1 );
249- ASSERT_EQ (m_comm_out, 0U );
250- ASSERT_from_bufferOut_SIZE (0 );
251- ASSERT_from_eventOut_SIZE (0 );
252- ASSERT_from_tlmOut_SIZE (0 );
253- ASSERT_from_cmdDispOut_SIZE (0 );
254- ASSERT_from_cmdRespOut_SIZE (0 );
243+ this ->assert_no_outputs_sent ();
255244
256245 // Invalid bufferOut destination port should return the buffer
257246 clearFromPortHistory ();
258247 this ->send_from_driver_packet (static_cast <U32>(GenericHub::HUB_TYPE_BUFFER),
259248 this ->componentOut .getNum_bufferOut_OutputPorts (), 0 , nullptr , 0 );
260249 ASSERT_from_fromBufferDriverReturn_SIZE (1 );
261- ASSERT_EQ (m_comm_out, 0U );
262- ASSERT_from_bufferOut_SIZE (0 );
263- ASSERT_from_eventOut_SIZE (0 );
264- ASSERT_from_tlmOut_SIZE (0 );
265- ASSERT_from_cmdDispOut_SIZE (0 );
266- ASSERT_from_cmdRespOut_SIZE (0 );
250+ this ->assert_no_outputs_sent ();
267251
268252 // Command dispatch path: raw payload too small to include context
269253 clearFromPortHistory ();
270254 this ->send_from_driver_packet (static_cast <U32>(GenericHub::HUB_TYPE_CMD_DISP), 0 , 0 , nullptr , 0 );
271255 ASSERT_from_fromBufferDriverReturn_SIZE (1 );
272- ASSERT_EQ (m_comm_out, 0U );
273- ASSERT_from_bufferOut_SIZE (0 );
274- ASSERT_from_eventOut_SIZE (0 );
275- ASSERT_from_tlmOut_SIZE (0 );
276- ASSERT_from_cmdDispOut_SIZE (0 );
277- ASSERT_from_cmdRespOut_SIZE (0 );
256+ this ->assert_no_outputs_sent ();
278257
279258 // Command dispatch path: raw payload larger than ComBuffer supports
280259 clearFromPortHistory ();
@@ -283,12 +262,7 @@ void GenericHubTester ::test_invalid_deserialization_paths() {
283262 this ->send_from_driver_packet (static_cast <U32>(GenericHub::HUB_TYPE_CMD_DISP), 0 , tooLargeCmdSize, m_data_store,
284263 tooLargeCmdSize);
285264 ASSERT_from_fromBufferDriverReturn_SIZE (1 );
286- ASSERT_EQ (m_comm_out, 0U );
287- ASSERT_from_bufferOut_SIZE (0 );
288- ASSERT_from_eventOut_SIZE (0 );
289- ASSERT_from_tlmOut_SIZE (0 );
290- ASSERT_from_cmdDispOut_SIZE (0 );
291- ASSERT_from_cmdRespOut_SIZE (0 );
265+ this ->assert_no_outputs_sent ();
292266
293267 clearFromPortHistory ();
294268}
0 commit comments