@@ -1182,32 +1182,28 @@ void SC_ParseRts_Test_CmdLengthEqualsBufferLength(void)
1182
1182
1183
1183
void SC_ParseRts_Test_CmdDoesNotFitBufferEmpty (void )
1184
1184
{
1185
- SC_RtsEntryHeader_t * Entry ;
1186
- uint8 RtsIndex = 0 ;
1187
- uint32 RtsTable [SC_RTS_BUFF_SIZE32 ];
1188
- CFE_SB_MsgId_t TestMsgId = SC_UT_MID_1 ;
1189
- size_t MsgSize1 = SC_PACKET_MAX_SIZE ;
1190
- size_t MsgSize2 ;
1191
- int BufEntrySize ;
1185
+ uint8 RtsIndex = 0 ;
1186
+ uint32 RtsTable [SC_RTS_BUFF_SIZE32 ];
1187
+ CFE_SB_MsgId_t TestMsgId = SC_UT_MID_1 ;
1188
+ size_t MsgSize1 = SC_PACKET_MAX_SIZE ;
1189
+ size_t MsgSize2 ;
1190
+ int BufEntrySize ;
1192
1191
1193
1192
SC_InitTables ();
1194
1193
1195
1194
memset (& RtsTable , 0 , sizeof (RtsTable ));
1196
1195
1197
1196
SC_OperData .RtsTblAddr [RtsIndex ] = & RtsTable [0 ];
1198
1197
1199
- Entry = (SC_RtsEntryHeader_t * )& SC_OperData .RtsTblAddr [RtsIndex ][0 ];
1200
- Entry -> TimeTag = 1 ;
1201
-
1202
1198
UT_SetDataBuffer (UT_KEY (CFE_MSG_GetMsgId ), & TestMsgId , sizeof (TestMsgId ), false);
1203
1199
UT_SetDataBuffer (UT_KEY (CFE_MSG_GetMsgId ), & TestMsgId , sizeof (TestMsgId ), false);
1204
1200
1201
+ /* Maximum size first command */
1205
1202
BufEntrySize = (MsgSize1 + SC_ROUND_UP_BYTES ) / SC_BYTES_IN_WORD + SC_RTS_HDR_NOPKT_WORDS ;
1206
-
1207
1203
UT_SetDataBuffer (UT_KEY (CFE_MSG_GetSize ), & MsgSize1 , sizeof (MsgSize1 ), false);
1208
1204
1209
- /* Use the remaining buffer space to calculate the final message size */
1210
- MsgSize2 = ((SC_RTS_BUFF_SIZE32 - SC_RTS_HDR_NOPKT_WORDS - BufEntrySize ) * SC_BYTES_IN_WORD );
1205
+ /* All but last 32 bits for 2nd command */
1206
+ MsgSize2 = ((SC_RTS_BUFF_SIZE32 - SC_RTS_HDR_NOPKT_WORDS - BufEntrySize - 1 ) * SC_BYTES_IN_WORD );
1211
1207
UT_SetDataBuffer (UT_KEY (CFE_MSG_GetSize ), & MsgSize2 , sizeof (MsgSize2 ), false);
1212
1208
1213
1209
/* Execute the function being tested */
@@ -1240,11 +1236,11 @@ void SC_ParseRts_Test_CmdDoesNotFitBufferNotEmpty(void)
1240
1236
UT_SetDataBuffer (UT_KEY (CFE_MSG_GetMsgId ), & TestMsgId , sizeof (TestMsgId ), false);
1241
1237
UT_SetDataBuffer (UT_KEY (CFE_MSG_GetMsgId ), & TestMsgId , sizeof (TestMsgId ), false);
1242
1238
1239
+ /* Maximum size first command */
1243
1240
BufEntrySize = (MsgSize1 + SC_ROUND_UP_BYTES ) / SC_BYTES_IN_WORD + SC_RTS_HDR_NOPKT_WORDS ;
1244
-
1245
1241
UT_SetDataBuffer (UT_KEY (CFE_MSG_GetSize ), & MsgSize1 , sizeof (MsgSize1 ), false);
1246
1242
1247
- /* Use all but one 32-bit "word" of remaining space */
1243
+ /* All but last 32 bits for 2nd command */
1248
1244
MsgSize2 = ((SC_RTS_BUFF_SIZE32 - SC_RTS_HDR_NOPKT_WORDS - BufEntrySize - 1 ) * SC_BYTES_IN_WORD );
1249
1245
UT_SetDataBuffer (UT_KEY (CFE_MSG_GetSize ), & MsgSize2 , sizeof (MsgSize2 ), false);
1250
1246
0 commit comments