@@ -57,17 +57,15 @@ int suiteTearDown( int numFailures )
57
57
/* ============================= CALLBACKS ============================= */
58
58
59
59
bool mqtt_subscribe_stream_json_true ( char * topic ,
60
- size_t topicLength ,
61
- int NumCalls )
60
+ size_t topicLength )
62
61
{
63
62
TEST_ASSERT_EQUAL_MEMORY ( "$aws/things/thingname/streams/stream-name/data/json" , topic , strlen ( "$aws/things/thingname/streams/stream-name/data/json" ) );
64
63
TEST_ASSERT_EQUAL_INT ( strlen ( "$aws/things/thingname/streams/stream-name/data/json" ), topicLength );
65
64
return true;
66
65
}
67
66
68
67
bool mqtt_subscribe_stream_json_false ( char * topic ,
69
- size_t topicLength ,
70
- int NumCalls )
68
+ size_t topicLength )
71
69
{
72
70
TEST_ASSERT_EQUAL_MEMORY ( "$aws/things/thingname/streams/stream-name/data/json" , topic , strlen ( "$aws/things/thingname/streams/stream-name/data/json" ) );
73
71
TEST_ASSERT_EQUAL_INT ( strlen ( "$aws/things/thingname/streams/stream-name/data/json" ), topicLength );
@@ -76,17 +74,15 @@ bool mqtt_subscribe_stream_json_false( char * topic,
76
74
77
75
78
76
bool mqtt_subscribe_stream_cbor_true ( char * topic ,
79
- size_t topicLength ,
80
- int NumCalls )
77
+ size_t topicLength )
81
78
{
82
79
TEST_ASSERT_EQUAL_MEMORY ( "$aws/things/thingname/streams/stream-name/data/cbor" , topic , strlen ( "$aws/things/thingname/streams/stream-name/data/cbor" ) );
83
80
TEST_ASSERT_EQUAL_INT ( strlen ( "$aws/things/thingname/streams/stream-name/data/cbor" ), topicLength );
84
81
return true;
85
82
}
86
83
87
84
bool mqtt_subscribe_stream_cbor_false ( char * topic ,
88
- size_t topicLength ,
89
- int NumCalls )
85
+ size_t topicLength )
90
86
{
91
87
TEST_ASSERT_EQUAL_MEMORY ( "$aws/things/thingname/streams/stream-name/data/cbor" , topic , strlen ( "$aws/things/thingname/streams/stream-name/data/cbor" ) );
92
88
TEST_ASSERT_EQUAL_INT ( strlen ( "$aws/things/thingname/streams/stream-name/data/cbor" ), topicLength );
@@ -96,8 +92,7 @@ bool mqtt_subscribe_stream_cbor_false( char * topic,
96
92
bool mqtt_publish_request_json_true ( char * topic ,
97
93
size_t topicLength ,
98
94
uint8_t * message ,
99
- size_t messageLength ,
100
- int NumCalls )
95
+ size_t messageLength )
101
96
{
102
97
TEST_ASSERT_EQUAL_MEMORY ( getStreamTopic , topic , getStreamTopicLength );
103
98
TEST_ASSERT_EQUAL_INT ( getStreamTopicLength , topicLength );
@@ -109,8 +104,7 @@ bool mqtt_publish_request_json_true( char * topic,
109
104
bool mqtt_publish_request_json_false ( char * topic ,
110
105
size_t topicLength ,
111
106
uint8_t * message ,
112
- size_t messageLength ,
113
- int NumCalls )
107
+ size_t messageLength )
114
108
{
115
109
TEST_ASSERT_EQUAL_MEMORY ( getStreamTopic , topic , getStreamTopicLength );
116
110
TEST_ASSERT_EQUAL_INT ( getStreamTopicLength , topicLength );
@@ -208,7 +202,7 @@ void test_createGetDataBlockRequest_succeedsForCBORDataType( void )
208
202
char * encodedMessage = "expected-message" ;
209
203
size_t expectedCborSize = 9999U ;
210
204
211
- CBOR_Encode_GetStreamRequestMessage_ExpectAndReturn ( getStreamRequest ,
205
+ CBOR_Encode_GetStreamRequestMessage_ExpectAndReturn ( ( uint8_t * ) & getStreamRequest ,
212
206
GET_STREAM_REQUEST_BUFFER_SIZE ,
213
207
NULL ,
214
208
"rdy" ,
@@ -223,7 +217,7 @@ void test_createGetDataBlockRequest_succeedsForCBORDataType( void )
223
217
CBOR_Encode_GetStreamRequestMessage_IgnoreArg_encodedMessageSize ();
224
218
CBOR_Encode_GetStreamRequestMessage_IgnoreArg_messageBuffer ();
225
219
CBOR_Encode_GetStreamRequestMessage_ReturnThruPtr_encodedMessageSize ( & expectedCborSize );
226
- CBOR_Encode_GetStreamRequestMessage_ReturnThruPtr_messageBuffer ( encodedMessage );
220
+ CBOR_Encode_GetStreamRequestMessage_ReturnThruPtr_messageBuffer ( ( uint8_t * ) encodedMessage );
227
221
228
222
requestLength = mqttDownloader_createGetDataBlockRequest ( DATA_TYPE_CBOR , 4U , 3U , 2U , 1U , getStreamRequest , getStreamRequestLength );
229
223
TEST_ASSERT_EQUAL ( expectedCborSize , requestLength );
@@ -235,9 +229,6 @@ void test_createGetDataBlockRequest_FailsWhenGetStreamRequestLengthTooSmall( voi
235
229
char getStreamRequest [ GET_STREAM_REQUEST_BUFFER_SIZE ];
236
230
size_t getStreamRequestLength = 0 ;
237
231
238
- char * encodedMessage = "expected-message" ;
239
- size_t expectedCborSize = 9999U ;
240
-
241
232
requestLength = mqttDownloader_createGetDataBlockRequest ( DATA_TYPE_JSON , 4U , 3U , 2U , 1U , getStreamRequest , getStreamRequestLength );
242
233
TEST_ASSERT_EQUAL ( 0 , requestLength );
243
234
}
@@ -246,9 +237,6 @@ void test_createGetDataBlockRequest_FailsWhenGetStreamRequestBufferIsNull( void
246
237
{
247
238
size_t getStreamRequestLength = GET_STREAM_REQUEST_BUFFER_SIZE ;
248
239
249
- char * encodedMessage = "expected-message" ;
250
- size_t expectedCborSize = 9999U ;
251
-
252
240
requestLength = mqttDownloader_createGetDataBlockRequest ( DATA_TYPE_JSON , 4U , 3U , 2U , 1U , NULL , getStreamRequestLength );
253
241
TEST_ASSERT_EQUAL ( 0 , requestLength );
254
242
}
@@ -313,7 +301,7 @@ void test_processReceivedDataBlock_processesJSONBlock( void )
313
301
uint8_t decodedData [ mqttFileDownloader_CONFIG_BLOCK_SIZE ];
314
302
size_t dataLength = 0 ;
315
303
316
- bool result = mqttDownloader_processReceivedDataBlock ( & context , "{\"p\": \"dGVzdA==\"}" , strlen ( "{\"p\": \"dGVzdA==\"}" ), decodedData , & dataLength );
304
+ bool result = mqttDownloader_processReceivedDataBlock ( & context , ( uint8_t * ) "{\"p\": \"dGVzdA==\"}" , strlen ( "{\"p\": \"dGVzdA==\"}" ), decodedData , & dataLength );
317
305
318
306
TEST_ASSERT_TRUE ( result );
319
307
TEST_ASSERT_EQUAL ( 4 , dataLength );
@@ -328,7 +316,7 @@ void test_processReceivedDataBlock_invalidJSONBlock( void )
328
316
uint8_t decodedData [ mqttFileDownloader_CONFIG_BLOCK_SIZE ];
329
317
size_t dataLength = 0 ;
330
318
331
- MQTTFileDownloaderStatus_t result = mqttDownloader_processReceivedDataBlock ( & context , "{\"wrongKey\": \"dGVzdA==\"}" , strlen ( "{\"wrongKey\": \"dGVzdA==\"}" ), decodedData , & dataLength );
319
+ MQTTFileDownloaderStatus_t result = mqttDownloader_processReceivedDataBlock ( & context , ( uint8_t * ) "{\"wrongKey\": \"dGVzdA==\"}" , strlen ( "{\"wrongKey\": \"dGVzdA==\"}" ), decodedData , & dataLength );
332
320
333
321
TEST_ASSERT_EQUAL ( 7 , result );
334
322
TEST_ASSERT_EQUAL ( 0 , dataLength );
@@ -343,7 +331,7 @@ void test_processReceivedDataBlock_invalidEncodingJSONBlock( void )
343
331
uint8_t decodedData [ mqttFileDownloader_CONFIG_BLOCK_SIZE ];
344
332
size_t dataLength = 0 ;
345
333
346
- MQTTFileDownloaderStatus_t result = mqttDownloader_processReceivedDataBlock ( & context , "{\"p\": \"notEncoded\"}" , strlen ( "{\"p\": \"notEncoded\"}" ), decodedData , & dataLength );
334
+ MQTTFileDownloaderStatus_t result = mqttDownloader_processReceivedDataBlock ( & context , ( uint8_t * ) "{\"p\": \"notEncoded\"}" , strlen ( "{\"p\": \"notEncoded\"}" ), decodedData , & dataLength );
347
335
348
336
TEST_ASSERT_EQUAL ( 7 , result );
349
337
TEST_ASSERT_EQUAL ( 0 , dataLength );
@@ -360,15 +348,15 @@ void test_processReceivedDataBlock_processesCBORBlock( void )
360
348
uint8_t decodedData [ mqttFileDownloader_CONFIG_BLOCK_SIZE ];
361
349
size_t dataLength = 0 ;
362
350
363
- CBOR_Decode_GetStreamResponseMessage_ExpectAndReturn ( validCBORMsg , strlen ( validCBORMsg ), NULL , NULL , NULL , NULL , NULL , true );
351
+ CBOR_Decode_GetStreamResponseMessage_ExpectAndReturn ( ( const uint8_t * ) validCBORMsg , strlen ( validCBORMsg ), NULL , NULL , NULL , NULL , NULL , true );
364
352
CBOR_Decode_GetStreamResponseMessage_IgnoreArg_fileId ();
365
353
CBOR_Decode_GetStreamResponseMessage_IgnoreArg_blockSize ();
366
354
CBOR_Decode_GetStreamResponseMessage_IgnoreArg_blockId ();
367
355
CBOR_Decode_GetStreamResponseMessage_IgnoreArg_payload ();
368
356
CBOR_Decode_GetStreamResponseMessage_IgnoreArg_payloadSize ();
369
357
CBOR_Decode_GetStreamResponseMessage_ReturnThruPtr_payloadSize ( & expectedProcessedDataLength );
370
358
371
- bool result = mqttDownloader_processReceivedDataBlock ( & context , validCBORMsg , strlen ( validCBORMsg ), decodedData , & dataLength );
359
+ bool result = mqttDownloader_processReceivedDataBlock ( & context , ( uint8_t * ) validCBORMsg , strlen ( validCBORMsg ), decodedData , & dataLength );
372
360
373
361
TEST_ASSERT_TRUE ( result );
374
362
TEST_ASSERT_EQUAL ( expectedProcessedDataLength , dataLength );
@@ -385,15 +373,15 @@ void test_processReceivedDataBlock_invalidCBORBlock( void )
385
373
uint8_t decodedData [ mqttFileDownloader_CONFIG_BLOCK_SIZE ];
386
374
size_t dataLength = 0 ;
387
375
388
- CBOR_Decode_GetStreamResponseMessage_ExpectAndReturn ( invalidCBORMsg , strlen ( invalidCBORMsg ), NULL , NULL , NULL , NULL , NULL , false );
376
+ CBOR_Decode_GetStreamResponseMessage_ExpectAndReturn ( ( const uint8_t * ) invalidCBORMsg , strlen ( invalidCBORMsg ), NULL , NULL , NULL , NULL , NULL , false );
389
377
CBOR_Decode_GetStreamResponseMessage_IgnoreArg_fileId ();
390
378
CBOR_Decode_GetStreamResponseMessage_IgnoreArg_blockSize ();
391
379
CBOR_Decode_GetStreamResponseMessage_IgnoreArg_blockId ();
392
380
CBOR_Decode_GetStreamResponseMessage_IgnoreArg_payload ();
393
381
CBOR_Decode_GetStreamResponseMessage_IgnoreArg_payloadSize ();
394
382
CBOR_Decode_GetStreamResponseMessage_ReturnThruPtr_payloadSize ( & notExpectedProcessedDataLength );
395
383
396
- MQTTFileDownloaderStatus_t result = mqttDownloader_processReceivedDataBlock ( & context , invalidCBORMsg , strlen ( invalidCBORMsg ), decodedData , & dataLength );
384
+ MQTTFileDownloaderStatus_t result = mqttDownloader_processReceivedDataBlock ( & context , ( uint8_t * ) invalidCBORMsg , strlen ( invalidCBORMsg ), decodedData , & dataLength );
397
385
398
386
TEST_ASSERT_EQUAL ( 7 , result );
399
387
TEST_ASSERT_EQUAL ( 0 , dataLength );
@@ -421,7 +409,7 @@ void test_processReceivedDataBlock_returnsFailureWhenMessageLengthZero( void )
421
409
uint8_t decodedData [ mqttFileDownloader_CONFIG_BLOCK_SIZE ];
422
410
size_t dataLength = 0 ;
423
411
424
- uintResult = mqttDownloader_processReceivedDataBlock ( & context , "{\"p\": \"dGVzdA==\"}" , 0U , decodedData , & dataLength );
412
+ uintResult = mqttDownloader_processReceivedDataBlock ( & context , ( uint8_t * ) "{\"p\": \"dGVzdA==\"}" , 0U , decodedData , & dataLength );
425
413
TEST_ASSERT_EQUAL ( MQTTFileDownloaderFailure , uintResult );
426
414
}
427
415
@@ -431,10 +419,9 @@ void test_processReceivedDataBlock_returnsFailureWhenDataIsNull( void )
431
419
432
420
context .dataType = DATA_TYPE_JSON ;
433
421
434
- uint8_t decodedData [ mqttFileDownloader_CONFIG_BLOCK_SIZE ];
435
422
size_t dataLength = 0 ;
436
423
437
- uintResult = mqttDownloader_processReceivedDataBlock ( & context , "{\"p\": \"dGVzdA==\"}" , strlen ( "{\"p\": \"dGVzdA==\"}" ), NULL , & dataLength );
424
+ uintResult = mqttDownloader_processReceivedDataBlock ( & context , ( uint8_t * ) "{\"p\": \"dGVzdA==\"}" , strlen ( "{\"p\": \"dGVzdA==\"}" ), NULL , & dataLength );
438
425
TEST_ASSERT_EQUAL ( MQTTFileDownloaderFailure , uintResult );
439
426
}
440
427
@@ -447,6 +434,6 @@ void test_processReceivedDataBlock_returnsFailureWhenDataLengthIsNull( void )
447
434
uint8_t decodedData [ mqttFileDownloader_CONFIG_BLOCK_SIZE ];
448
435
size_t * dataLength = NULL ;
449
436
450
- uintResult = mqttDownloader_processReceivedDataBlock ( & context , "{\"p\": \"dGVzdA==\"}" , strlen ( "{\"p\": \"dGVzdA==\"}" ), decodedData , dataLength );
437
+ uintResult = mqttDownloader_processReceivedDataBlock ( & context , ( uint8_t * ) "{\"p\": \"dGVzdA==\"}" , strlen ( "{\"p\": \"dGVzdA==\"}" ), decodedData , dataLength );
451
438
TEST_ASSERT_EQUAL ( MQTTFileDownloaderFailure , uintResult );
452
439
}
0 commit comments