From 04e1d8e7de3794565cabfdd7e9569297f7fef850 Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Mon, 9 Mar 2015 14:59:22 +0100 Subject: [PATCH] Make test data unsigned to shut up compiler warnings. --- tests/test_error_response.c | 16 ++++++------- tests/test_options.c | 46 ++++++++++++++++++------------------- tests/test_pdu.c | 44 +++++++++++++++++------------------ tests/test_uri.c | 2 +- 4 files changed, 54 insertions(+), 54 deletions(-) diff --git a/tests/test_error_response.c b/tests/test_error_response.c index 61084fb2..ce785817 100644 --- a/tests/test_error_response.c +++ b/tests/test_error_response.c @@ -24,7 +24,7 @@ coap_opt_filter_t opts; /* option filter used for generating responses */ static void t_error_response1(void) { - char teststr[] = { + uint8_t teststr[] = { 0x60, 0x80, 0x12, 0x34, 0xff, 'B', 'a', 'd', ' ', 'R', 'e', 'q', 'u', 'e', 's', 't' }; @@ -52,7 +52,7 @@ t_error_response1(void) { static void t_error_response2(void) { - char teststr[] = { + uint8_t teststr[] = { 0x55, 0x84, 0x12, 0x34, 't', 'o', 'k', 'e', 'n', 0xff, 'N', 'o', 't', ' ', 'F', 'o', 'u', 'n', 'd' @@ -82,7 +82,7 @@ t_error_response2(void) { static void t_error_response3(void) { const unsigned char code = COAP_RESPONSE_CODE(402); - char teststr[] = { + uint8_t teststr[] = { 0x65, code, 0x00, 0x00, 't', 'o', 'k', 'e', 'n', 0x90, 0xff, 'B', 'a', 'd', ' ', 'O', 'p', 't', 'i', 'o', 'n' @@ -119,7 +119,7 @@ t_error_response4(void) { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b }; - char teststr[] = { + uint8_t teststr[] = { 0x65, code, 0x00, 0x00, 't', 'o', 'k', 'e', 'n', 0x9c, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0xff, 'B', @@ -159,7 +159,7 @@ t_error_response5(void) { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 }; - char teststr[] = { + uint8_t teststr[] = { 0x65, code, 0x00, 0x00, 't', 'o', 'k', 'e', 'n', 0x9d, 0x06, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, @@ -200,7 +200,7 @@ t_error_response6(void) { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 }; - char teststr[] = { + uint8_t teststr[] = { 0x65, code, 0x00, 0x00, 't', 'o', 'k', 'e', 'n', 0xdd, 0x0a, 0x06, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, @@ -241,7 +241,7 @@ t_error_response7(void) { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 }; - char teststr[] = { + uint8_t teststr[] = { 0x65, code, 0x00, 0x00, 't', 'o', 'k', 'e', 'n', 0xdd, 0x0a, 0x06, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, @@ -278,7 +278,7 @@ t_error_response7(void) { static void t_error_response8(void) { const unsigned char code = COAP_RESPONSE_CODE(503); - char teststr[] = { + uint8_t teststr[] = { 0x65, code, 0x00, 0x00, 't', 'o', 'k', 'e', 'n', 0xe0, 0x02, 0xdc, 0xd0, 0x00, 0xff, 'S', 'e', 'r', 'v', 'i', 'c', 'e', ' ', 'U', diff --git a/tests/test_options.c b/tests/test_options.c index 8e59d485..30e02afc 100644 --- a/tests/test_options.c +++ b/tests/test_options.c @@ -243,7 +243,7 @@ t_encode_option1(void) { static void t_encode_option2(void) { - char teststr[] = { 0x5d, 0xff }; + uint8_t teststr[] = { 0x5d, 0xff }; unsigned char buf[40]; size_t result; @@ -255,7 +255,7 @@ t_encode_option2(void) { static void t_encode_option3(void) { - char teststr[] = { 0xd1, 0x01 }; + uint8_t teststr[] = { 0xd1, 0x01 }; unsigned char buf[40]; size_t result; @@ -267,7 +267,7 @@ t_encode_option3(void) { static void t_encode_option4(void) { - char teststr[] = { 0xdd, 0xff, 0xab }; + uint8_t teststr[] = { 0xdd, 0xff, 0xab }; unsigned char buf[40]; size_t result; @@ -279,7 +279,7 @@ t_encode_option4(void) { static void t_encode_option5(void) { - char teststr[] = { 0xed, 0x13, 0x00, 0xff }; + uint8_t teststr[] = { 0xed, 0x13, 0x00, 0xff }; unsigned char buf[40]; size_t result; @@ -291,7 +291,7 @@ t_encode_option5(void) { static void t_encode_option6(void) { - char teststr[] = { 0xee, 0xfe, 0xf2, 0xfe, 0xf2 }; + uint8_t teststr[] = { 0xee, 0xfe, 0xf2, 0xfe, 0xf2 }; unsigned char buf[40]; size_t result; @@ -303,7 +303,7 @@ t_encode_option6(void) { static void t_encode_option7(void) { - char teststr[] = { 0x35, 'v', 'a', 'l', 'u', 'e' }; + uint8_t teststr[] = { 0x35, 'v', 'a', 'l', 'u', 'e' }; const size_t valoff = 1; unsigned char buf[40]; size_t result; @@ -340,7 +340,7 @@ t_encode_option8(void) { static void t_access_option1(void) { - const char teststr[] = { 0x12, 'a', 'b' }; + const uint8_t teststr[] = { 0x12, 'a', 'b' }; CU_ASSERT(coap_opt_delta((coap_opt_t *)teststr) == 1); CU_ASSERT(coap_opt_length((coap_opt_t *)teststr) == 2); @@ -350,7 +350,7 @@ t_access_option1(void) { static void t_access_option2(void) { - const char teststr[] = { 0xe2, 0x18, 0xfd, 'a', 'b' }; + const uint8_t teststr[] = { 0xe2, 0x18, 0xfd, 'a', 'b' }; CU_ASSERT(coap_opt_delta((coap_opt_t *)teststr) == 6666); CU_ASSERT(coap_opt_length((coap_opt_t *)teststr) == 2); @@ -360,7 +360,7 @@ t_access_option2(void) { static void t_access_option3(void) { - const char teststr[] = { 0xed, 0x18, 0x0a, 0x00, 'a', 'b', 'c', 'd', + const uint8_t teststr[] = { 0xed, 0x18, 0x0a, 0x00, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm' }; @@ -373,7 +373,7 @@ t_access_option3(void) { static void t_access_option4(void) { - const char teststr[] = { 0xde, 0xff, 0xfe, 0xf2, 'a', 'b', 'c' }; + const uint8_t teststr[] = { 0xde, 0xff, 0xfe, 0xf2, 'a', 'b', 'c' }; CU_ASSERT(coap_opt_delta((coap_opt_t *)teststr) == 268); CU_ASSERT(coap_opt_length((coap_opt_t *)teststr) == 65535); @@ -383,7 +383,7 @@ t_access_option4(void) { static void t_access_option5(void) { - const char teststr[] = { 0xee, 0xfe, 0xf2, 0x00, 0xdd, 'a', 'b', 'c' }; + const uint8_t teststr[] = { 0xee, 0xfe, 0xf2, 0x00, 0xdd, 'a', 'b', 'c' }; CU_ASSERT(coap_opt_delta((coap_opt_t *)teststr) == 65535); CU_ASSERT(coap_opt_length((coap_opt_t *)teststr) == 490); @@ -393,7 +393,7 @@ t_access_option5(void) { static void t_access_option6(void) { - const char teststr[] = { 0xf2, 'a', 'b' }; + const uint8_t teststr[] = { 0xf2, 'a', 'b' }; CU_ASSERT(coap_opt_delta((coap_opt_t *)teststr) == 0); CU_ASSERT(coap_opt_length((coap_opt_t *)teststr) == 0); @@ -403,7 +403,7 @@ t_access_option6(void) { static void t_access_option7(void) { - const char teststr[] = { 0x2f, 'a', 'b' }; + const uint8_t teststr[] = { 0x2f, 'a', 'b' }; CU_ASSERT(coap_opt_delta((coap_opt_t *)teststr) == 2); CU_ASSERT(coap_opt_length((coap_opt_t *)teststr) == 0); @@ -420,7 +420,7 @@ t_access_option7(void) { static void t_iterate_option1(void) { /* CoAP PDU without token, options, or data */ - char teststr[] __attribute__ ((aligned (8))) = { + uint8_t teststr[] __attribute__ ((aligned (8))) = { 0x00, 0x00, 0x00, 0x00 }; @@ -445,7 +445,7 @@ t_iterate_option1(void) { static void t_iterate_option2(void) { /* CoAP PDU with token but without options and data */ - char teststr[] __attribute__ ((aligned (8))) = { + uint8_t teststr[] __attribute__ ((aligned (8))) = { 0x03, 0x00, 0x00, 0x00, 't', 'o', 'k' }; @@ -470,7 +470,7 @@ t_iterate_option2(void) { static void t_iterate_option3(void) { /* CoAP PDU with token and options */ - char teststr[] __attribute__ ((aligned (8))) = { + uint8_t teststr[] __attribute__ ((aligned (8))) = { 0x03, 0x00, 0x00, 0x00, 't', 'o', 'k', 0x13, 'o', 'p', 't', 0x00, 0xd1, 0x10, 'x' }; @@ -511,7 +511,7 @@ t_iterate_option3(void) { static void t_iterate_option4(void) { /* CoAP PDU with token, options, and data */ - char teststr[] __attribute__ ((aligned (8))) = { + uint8_t teststr[] __attribute__ ((aligned (8))) = { 0x03, 0x00, 0x00, 0x00, 't', 'o', 'k', 0x13, 'o', 'p', 't', 0x00, 0xd1, 0x10, 'x', 0xff, 'd', 'a', 't', 'a' @@ -553,7 +553,7 @@ t_iterate_option4(void) { static void t_iterate_option5(void) { /* CoAP PDU with malformed option */ - char teststr[] __attribute__ ((aligned (8))) = { + uint8_t teststr[] __attribute__ ((aligned (8))) = { 0x00, 0x00, 0x00, 0x00, 0x52, 'o', 'p', 0xee, 0x12, 0x03, 0x00 }; @@ -585,7 +585,7 @@ static void t_iterate_option6(void) { /* option filter */ /* CoAP PDU with token, options, and data */ - char teststr[] __attribute__ ((aligned (8))) = { + uint8_t teststr[] __attribute__ ((aligned (8))) = { 0x00, 0x00, 0x00, 0x00, 0x80, 0x20, 0x00, 0x00, 0xc0, 0x00 }; @@ -629,7 +629,7 @@ t_iterate_option6(void) { static void t_iterate_option7(void) { /* option filter */ - char teststr[] __attribute__ ((aligned (8))) = { + uint8_t teststr[] __attribute__ ((aligned (8))) = { 0x00, 0x00, 0x00, 0x00, 0x80, 0x20, 0x00, 0x00, 0xc0, 0x00, 0x10, 0x10, 0x00 }; @@ -675,7 +675,7 @@ t_iterate_option7(void) { static void t_iterate_option8(void) { /* option filter */ - char teststr[] __attribute__ ((aligned (8))) = { + uint8_t teststr[] __attribute__ ((aligned (8))) = { 0x00, 0x00, 0x00, 0x00, 0x80, 0x20, 0x00, 0x00, 0xc0, 0x00, 0x10, 0x10, 0x00 }; @@ -705,7 +705,7 @@ t_iterate_option8(void) { static void t_iterate_option9(void) { /* options filter: option number too large for filter */ - char teststr[] __attribute__ ((aligned (8))) = { + uint8_t teststr[] __attribute__ ((aligned (8))) = { 0x00, 0x00, 0x00, 0x00, 0x80, 0x20, 0x00, 0x00, 0xc0, 0x00, 0x10, 0x10, 0x00 }; @@ -735,7 +735,7 @@ t_iterate_option9(void) { static void t_iterate_option10(void) { /* options filter: option numbers in PDU exceed filter size */ - char teststr[] __attribute__ ((aligned (8))) = { + uint8_t teststr[] __attribute__ ((aligned (8))) = { 0x00, 0x00, 0x00, 0x00, 0x80, 0x20, 0x00, 0x00, 0xd0, 0x26, 0xe0, 0x10, 0x00 }; diff --git a/tests/test_pdu.c b/tests/test_pdu.c index b1067b87..1ae8460c 100644 --- a/tests/test_pdu.c +++ b/tests/test_pdu.c @@ -21,7 +21,7 @@ coap_pdu_t *pdu; /* Holds the parsed PDU for most tests */ static void t_parse_pdu1(void) { - char teststr[] = { 0x40, 0x01, 0x93, 0x34 }; + uint8_t teststr[] = { 0x40, 0x01, 0x93, 0x34 }; int result; result = coap_pdu_parse((unsigned char *)teststr, sizeof(teststr), pdu); @@ -38,7 +38,7 @@ t_parse_pdu1(void) { static void t_parse_pdu2(void) { - char teststr[] = { 0x55, 0x69, 0x12, 0x34, 't', 'o', 'k', 'e', 'n' }; + uint8_t teststr[] = { 0x55, 0x69, 0x12, 0x34, 't', 'o', 'k', 'e', 'n' }; int result; result = coap_pdu_parse((unsigned char *)teststr, sizeof(teststr), pdu); @@ -56,7 +56,7 @@ t_parse_pdu2(void) { static void t_parse_pdu3(void) { - char teststr[] = { 0x53, 0x69, 0x12, 0x34, 't', 'o', 'k', 'e', 'n' }; + uint8_t teststr[] = { 0x53, 0x69, 0x12, 0x34, 't', 'o', 'k', 'e', 'n' }; int result; result = coap_pdu_parse((unsigned char *)teststr, sizeof(teststr), pdu); @@ -66,7 +66,7 @@ t_parse_pdu3(void) { static void t_parse_pdu4(void) { /* illegal token length */ - char teststr[] = { 0x59, 0x69, 0x12, 0x34, + uint8_t teststr[] = { 0x59, 0x69, 0x12, 0x34, 't', 'o', 'k', 'e', 'n', '1', '2', '3', '4' }; int result; @@ -82,7 +82,7 @@ t_parse_pdu4(void) { static void t_parse_pdu5(void) { /* PDU with options */ - char teststr[] = { 0x55, 0x73, 0x12, 0x34, 't', 'o', 'k', 'e', + uint8_t teststr[] = { 0x55, 0x73, 0x12, 0x34, 't', 'o', 'k', 'e', 'n', 0x00, 0xc1, 0x00 }; int result; @@ -105,7 +105,7 @@ t_parse_pdu5(void) { static void t_parse_pdu6(void) { /* PDU with options that exceed the PDU */ - char teststr[] = { 0x55, 0x73, 0x12, 0x34, 't', 'o', 'k', 'e', + uint8_t teststr[] = { 0x55, 0x73, 0x12, 0x34, 't', 'o', 'k', 'e', 'n', 0x00, 0xc1, 0x00, 0xae, 0xf0, 0x03 }; int result; @@ -117,7 +117,7 @@ t_parse_pdu6(void) { static void t_parse_pdu7(void) { /* PDU with options and payload */ - char teststr[] = { 0x55, 0x73, 0x12, 0x34, 't', 'o', 'k', 'e', + uint8_t teststr[] = { 0x55, 0x73, 0x12, 0x34, 't', 'o', 'k', 'e', 'n', 0x00, 0xc1, 0x00, 0xff, 'p', 'a', 'y', 'l', 'o', 'a', 'd' }; @@ -143,7 +143,7 @@ t_parse_pdu7(void) { static void t_parse_pdu8(void) { /* PDU without options but with payload */ - char teststr[] = { 0x50, 0x73, 0x12, 0x34, + uint8_t teststr[] = { 0x50, 0x73, 0x12, 0x34, 0xff, 'p', 'a', 'y', 'l', 'o', 'a', 'd' }; @@ -168,7 +168,7 @@ t_parse_pdu8(void) { static void t_parse_pdu9(void) { /* PDU without options and payload but with payload start marker */ - char teststr[] = { 0x70, 0x00, 0x12, 0x34, 0xff }; + uint8_t teststr[] = { 0x70, 0x00, 0x12, 0x34, 0xff }; int result; result = coap_pdu_parse((unsigned char *)teststr, sizeof(teststr), pdu); @@ -178,7 +178,7 @@ t_parse_pdu9(void) { static void t_parse_pdu10(void) { /* PDU without payload but with options and payload start marker */ - char teststr[] = { 0x53, 0x73, 0x12, 0x34, 't', 'o', 'k', + uint8_t teststr[] = { 0x53, 0x73, 0x12, 0x34, 't', 'o', 'k', 0x30, 0xc1, 0x00, 0xff }; int result; @@ -189,7 +189,7 @@ t_parse_pdu10(void) { static void t_parse_pdu11(void) { - char teststr[] = { 0x60, 0x00, 0x12, 0x34 }; + uint8_t teststr[] = { 0x60, 0x00, 0x12, 0x34 }; int result; result = coap_pdu_parse((unsigned char *)teststr, sizeof(teststr), pdu); @@ -206,7 +206,7 @@ t_parse_pdu11(void) { static void t_parse_pdu12(void) { /* RST */ - char teststr[] = { 0x70, 0x00, 0x12, 0x34 }; + uint8_t teststr[] = { 0x70, 0x00, 0x12, 0x34 }; int result; result = coap_pdu_parse((unsigned char *)teststr, sizeof(teststr), pdu); @@ -223,7 +223,7 @@ t_parse_pdu12(void) { static void t_parse_pdu13(void) { /* RST with content */ - char teststr[] = { 0x70, 0x00, 0x12, 0x34, + uint8_t teststr[] = { 0x70, 0x00, 0x12, 0x34, 0xff, 'c', 'o', 'n', 't', 'e', 'n', 't' }; int result; @@ -235,7 +235,7 @@ t_parse_pdu13(void) { static void t_parse_pdu14(void) { /* ACK with content */ - char teststr[] = { 0x60, 0x00, 0x12, 0x34, + uint8_t teststr[] = { 0x60, 0x00, 0x12, 0x34, 0xff, 'c', 'o', 'n', 't', 'e', 'n', 't' }; int result; @@ -250,7 +250,7 @@ t_parse_pdu14(void) { static void t_encode_pdu1(void) { - char teststr[] = { 0x45, 0x01, 0x12, 0x34, 't', 'o', 'k', 'e', 'n' }; + uint8_t teststr[] = { 0x45, 0x01, 0x12, 0x34, 't', 'o', 'k', 'e', 'n' }; int result; coap_pdu_clear(pdu, pdu->max_size); @@ -296,7 +296,7 @@ t_encode_pdu3(void) { static void t_encode_pdu4(void) { /* PDU with options */ - char teststr[] = { 0x60, 0x99, 0x12, 0x34, 0x3d, 0x05, 0x66, 0x61, + uint8_t teststr[] = { 0x60, 0x99, 0x12, 0x34, 0x3d, 0x05, 0x66, 0x61, 0x6e, 0x63, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x63, 0x6f, 0x61, 0x70, 0x2e, 0x6d, 0x65, 0x84, 0x70, 0x61, 0x74, 0x68, 0x00, 0xe8, 0x1e, @@ -350,7 +350,7 @@ t_encode_pdu4(void) { static void t_encode_pdu5(void) { /* PDU with token and options */ - char teststr[] = { 0x68, 0x84, 0x12, 0x34, '1', '2', '3', '4', + uint8_t teststr[] = { 0x68, 0x84, 0x12, 0x34, '1', '2', '3', '4', '5', '6', '7', '8', 0x18, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0xd1, 0x03, 0x12 }; @@ -391,7 +391,7 @@ t_encode_pdu5(void) { static void t_encode_pdu6(void) { /* PDU with data */ - char teststr[] = { 0x50, 0x02, 0x12, 0x34, 0xff, '1', '2', '3', + uint8_t teststr[] = { 0x50, 0x02, 0x12, 0x34, 0xff, '1', '2', '3', '4', '5', '6', '7', '8' }; coap_pdu_clear(pdu, pdu->max_size); /* clear PDU */ @@ -412,7 +412,7 @@ t_encode_pdu6(void) { static void t_encode_pdu7(void) { /* PDU with empty data */ - char teststr[] = { 0x40, 0x43, 0x12, 0x34 }; + uint8_t teststr[] = { 0x40, 0x43, 0x12, 0x34 }; int result; coap_pdu_clear(pdu, pdu->max_size); /* clear PDU */ @@ -435,7 +435,7 @@ t_encode_pdu7(void) { static void t_encode_pdu8(void) { /* PDU with token and data */ - char teststr[] = { 0x42, 0x43, 0x12, 0x34, 0x00, 0x01, 0xff, 0x00 }; + uint8_t teststr[] = { 0x42, 0x43, 0x12, 0x34, 0x00, 0x01, 0xff, 0x00 }; int result; coap_pdu_clear(pdu, pdu->max_size); /* clear PDU */ @@ -462,7 +462,7 @@ t_encode_pdu8(void) { static void t_encode_pdu9(void) { /* PDU with options and data */ - char teststr[] = { 0x60, 0x44, 0x12, 0x34, 0x48, 's', 'o', 'm', + uint8_t teststr[] = { 0x60, 0x44, 0x12, 0x34, 0x48, 's', 'o', 'm', 'e', 'e', 't', 'a', 'g', 0x10, 0xdd, 0x11, 0x04, 's', 'o', 'm', 'e', 'r', 'a', 't', 'h', 'e', 'r', 'l', 'o', 'n', 'g', 'u', @@ -513,7 +513,7 @@ t_encode_pdu9(void) { static void t_encode_pdu10(void) { /* PDU with token, options and data */ - char teststr[] = { 0x62, 0x44, 0x12, 0x34, 0x00, 0x00, 0x8d, 0xf2, + uint8_t teststr[] = { 0x62, 0x44, 0x12, 0x34, 0x00, 0x00, 0x8d, 0xf2, 'c', 'o', 'a', 'p', ':', '/', '/', 'e', 'x', 'a', 'm', 'p', 'l', 'e', '.', 'c', 'o', 'm', '/', '1', '2', '3', '4', '5', diff --git a/tests/test_uri.c b/tests/test_uri.c index fd527767..b1ae44ed 100644 --- a/tests/test_uri.c +++ b/tests/test_uri.c @@ -315,7 +315,7 @@ t_parse_uri12(void) { static void t_parse_uri13(void) { - char teststr[] __attribute__ ((aligned (8))) = { + uint8_t teststr[] __attribute__ ((aligned (8))) = { 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 'f', 'o', 'o', 0x3b, '.', 'w', 'e', 'l', 'l', '-', 'k', 'n', 'o', 'w', 'n', 0x04, 'c', 'o',