Skip to content

Commit 8dc0358

Browse files
Update downloader_cbor_utest
Update downloader_cbor_utest to fix implicit type conversions.
1 parent 07ec076 commit 8dc0358

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

test/unit-test/downloader_cbor_utest.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
#define CBOR_GETSTREAMREQUEST_ITEM_COUNT 6
2424

2525
/* ============================ TEST GLOBALS ============================= */
26-
const uint8_t * decodeMessageBuffer = "decodeMessageBuffer";
27-
uint8_t * encodeMessageBuffer = "encodeMessageBuffer";
28-
const uint8_t * blockBitmap = "blockBitmap";
26+
const uint8_t * decodeMessageBuffer = (const uint8_t * ) "decodeMessageBuffer";
27+
uint8_t * encodeMessageBuffer = ( uint8_t * ) "encodeMessageBuffer";
28+
const uint8_t * blockBitmap = (const uint8_t * ) "blockBitmap";
2929
const char * clientToken = "clientToken";
3030
int32_t blockId = 1;
3131
int32_t blockSize = 2;
@@ -102,7 +102,7 @@ void cborFindsBlockIdKey( void )
102102

103103
void cborBlockIdKeyCorrectType( void )
104104
{
105-
cbor_value_get_type_ExpectAndReturn( &cborValue, CborNoError );
105+
cbor_value_get_type_ExpectAndReturn( &cborValue, (CborType) CborNoError );
106106
cbor_value_get_int_ExpectAndReturn( &cborValue, &blockId, CborNoError );
107107
}
108108

@@ -115,7 +115,7 @@ void cborFindsBlockSizeKey( void )
115115

116116
void cborBlockSizeKeyCorrectType( void )
117117
{
118-
cbor_value_get_type_ExpectAndReturn( &cborValue, CborNoError );
118+
cbor_value_get_type_ExpectAndReturn( &cborValue, (CborType) CborNoError );
119119
cbor_value_get_int_ExpectAndReturn( &cborValue, &blockSize, CborNoError );
120120
}
121121

@@ -187,7 +187,6 @@ void cborEncodesNumberOfBlocks( void )
187187

188188
void test_Decode_succeeds( void )
189189
{
190-
uint8_t payload;
191190
uint8_t * payloadPtr;
192191

193192
payloadSizeReceived = payloadSize - 1;
@@ -325,7 +324,7 @@ void test_Decode_returnsFalse_cannotGetBlockIdValue( void )
325324
cborFileIdKeyCorrectType();
326325
cborFindsBlockIdKey();
327326
cbor_value_get_type_ExpectAndReturn( &cborValue, CborNoError );
328-
cbor_value_get_int_ExpectAndReturn( &cborValue, &blockId, CborUnknownError );
327+
cbor_value_get_int_ExpectAndReturn( &cborValue, &blockId, (CborType) CborUnknownError );
329328

330329
result = CBOR_Decode_GetStreamResponseMessage( decodeMessageBuffer, 1234U, &fileId, &blockId, &blockSize, payload, &payloadSize );
331330
TEST_ASSERT_FALSE( result );
@@ -354,7 +353,7 @@ void test_Decode_returnsFalse_blockSizeWrongTypeInMap( void )
354353
cborFindsBlockIdKey();
355354
cborBlockIdKeyCorrectType();
356355
cborFindsBlockSizeKey();
357-
cbor_value_get_type_ExpectAndReturn( &cborValue, CborUnknownError );
356+
cbor_value_get_type_ExpectAndReturn( &cborValue, (CborType) CborUnknownError );
358357

359358
result = CBOR_Decode_GetStreamResponseMessage( decodeMessageBuffer, 1234U, &fileId, &blockId, &blockSize, payload, &payloadSize );
360359
TEST_ASSERT_FALSE( result );
@@ -369,7 +368,7 @@ void test_Decode_returnsFalse_cannotGetBlockSizeValue( void )
369368
cborFindsBlockIdKey();
370369
cborBlockIdKeyCorrectType();
371370
cborFindsBlockSizeKey();
372-
cbor_value_get_type_ExpectAndReturn( &cborValue, CborNoError );
371+
cbor_value_get_type_ExpectAndReturn( &cborValue, (CborType) CborNoError );
373372
cbor_value_get_int_ExpectAndReturn( &cborValue, &blockSize, CborUnknownError );
374373

375374
result = CBOR_Decode_GetStreamResponseMessage( decodeMessageBuffer, 1234U, &fileId, &blockId, &blockSize, payload, &payloadSize );
@@ -404,7 +403,7 @@ void test_Decode_returnsFalse_blockPayloadWrongTypeInMap( void )
404403
cborBlockSizeKeyCorrectType();
405404
cborFindsPayloadKeyInMap();
406405

407-
cbor_value_get_type_ExpectAndReturn( &cborValue, CborUnknownError );
406+
cbor_value_get_type_ExpectAndReturn( &cborValue, (CborType) CborUnknownError );
408407

409408
result = CBOR_Decode_GetStreamResponseMessage( decodeMessageBuffer, 1234U, &fileId, &blockId, &blockSize, payload, &payloadSize );
410409
TEST_ASSERT_FALSE( result );
@@ -451,7 +450,6 @@ void test_Decode_returnsFalse_blockPayloadLargerThanBuffer( void )
451450

452451
void test_Decode_returnsFalse_failsCopyingPayloadByteString( void )
453452
{
454-
uint8_t payload;
455453
uint8_t * payloadPtr;
456454

457455
payloadSizeReceived = payloadSize - 1;

tools/cmock/create_test.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function(create_test test_name test_src link_list dep_list include_list)
1515
add_executable(${test_name} ${test_src} ${test_name}_runner.c)
1616
set_target_properties(
1717
${test_name}
18-
PROPERTIES COMPILE_FLAG "-O0 -ggdb"
18+
PROPERTIES COMPILE_FLAG "-O0 -ggdb -Werror -Wall"
1919
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/tests"
2020
INSTALL_RPATH_USE_LINK_PATH TRUE
2121
LINK_FLAGS " \

0 commit comments

Comments
 (0)