summaryrefslogtreecommitdiff
path: root/tests.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests.c')
-rw-r--r--tests.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests.c b/tests.c
index 6c9d6fe..79dce46 100644
--- a/tests.c
+++ b/tests.c
@@ -7,37 +7,37 @@ void test_get_v_uint64_t()
{
enum pbstream_status status;
- char zero[] = {0x00};
- char *zero_buf = zero;
+ uint8_t zero[] = {0x00};
+ uint8_t *zero_buf = zero;
uint64_t zero_val = 0;
status = get_v_uint64_t(&zero_buf, &zero_val);
assert(status == PBSTREAM_STATUS_OK);
assert(zero_val == 0);
assert(zero_buf == zero + sizeof(zero));
- char one[] = {0x01};
- char *one_buf = one;
+ uint8_t one[] = {0x01};
+ uint8_t *one_buf = one;
uint64_t one_val = 0;
status = get_v_uint64_t(&one_buf, &one_val);
assert(status == PBSTREAM_STATUS_OK);
assert(one_val == 1);
- char twobyte[] = {0xAC, 0x02};
- char *twobyte_buf = twobyte;
+ uint8_t twobyte[] = {0xAC, 0x02};
+ uint8_t *twobyte_buf = twobyte;
uint64_t twobyte_val = 0;
status = get_v_uint64_t(&twobyte_buf, &twobyte_val);
assert(status == PBSTREAM_STATUS_OK);
assert(twobyte_val == 300);
- char ninebyte[] = {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x7F};
- char *ninebyte_buf = ninebyte;
+ uint8_t ninebyte[] = {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x7F};
+ uint8_t *ninebyte_buf = ninebyte;
uint64_t ninebyte_val = 0;
status = get_v_uint64_t(&ninebyte_buf, &ninebyte_val);
assert(status == PBSTREAM_STATUS_OK);
- assert(ninebyte_val == (1LL<<63));
+ assert(ninebyte_val == (1ULL<<63));
- char tenbyte[] = {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01};
- char *tenbyte_buf = tenbyte;
+ uint8_t tenbyte[] = {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01};
+ uint8_t *tenbyte_buf = tenbyte;
uint64_t tenbyte_val = 0;
status = get_v_uint64_t(&tenbyte_buf, &tenbyte_val);
assert(status == PBSTREAM_ERROR_UNTERMINATED_VARINT);
@@ -55,7 +55,7 @@ void test_simple_proto()
struct pbstream_fieldset fieldset1;
pbstream_init_fieldset(&fieldset1, fields1, 2);
- char message1[] = {0x08, 0x96, 0x01};
+ uint8_t message1[] = {0x08, 0x96, 0x01};
struct pbstream_parse_state s;
pbstream_init_parser(&s, &fieldset1);
assert(s.offset == 0);
@@ -68,7 +68,7 @@ void test_simple_proto()
assert(val.v.int32 == 150);
assert(s.offset == 3);
- char message2[] = {0x12, 0x07, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67};
+ uint8_t message2[] = {0x12, 0x07, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67};
pbstream_init_parser(&s, &fieldset1);
assert(pbstream_parse_field(&s, message2, &fieldnum, &val, &wv) ==
PBSTREAM_STATUS_OK);
@@ -83,7 +83,7 @@ void test_simple_proto()
fields2[0].fieldset = &fieldset1;
struct pbstream_fieldset fieldset2;
pbstream_init_fieldset(&fieldset2, fields2, 1);
- char message3[] = {0x1a, 0x03, 0x08, 0x96, 0x01};
+ uint8_t message3[] = {0x1a, 0x03, 0x08, 0x96, 0x01};
pbstream_init_parser(&s, &fieldset2);
assert(pbstream_parse_field(&s, message3, &fieldnum, &val, &wv) ==
PBSTREAM_STATUS_OK);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback