Skip to content

Commit

Permalink
Add more deserialization tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PJK committed Apr 25, 2015
1 parent 1df0b22 commit 2c7409a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/cbor_serialize_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ static void test_serialize_definite_bytestring(void **state) {
assert_memory_equal(buffer + 3, data, 256);
}

static void test_serialize_indefinite_bytestring(void **state) {
cbor_item_t * item = cbor_new_definite_bytestring();
unsigned char * data = malloc(256);
cbor_bytestring_set_handle(item, data, 256);
assert_int_equal(256 + 3, cbor_serialize(item, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){ 0x59, 0x01, 0x00 }), 3);
assert_memory_equal(buffer + 3, data, 256);
}

int main(void) {
const UnitTest tests[] = {
Expand Down

0 comments on commit 2c7409a

Please sign in to comment.