Skip to content

Commit

Permalink
Update cbor_describe after #281
Browse files Browse the repository at this point in the history
  • Loading branch information
PJK committed Jun 3, 2023
1 parent 219c2e7 commit 8340b01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static void _cbor_nested_describe(cbor_item_t *item, FILE *out, int indent) {
_cbor_nested_describe(cbor_bytestring_chunks_handle(item)[i], out,
indent + 4);
} else {
const unsigned char* data = cbor_bytestring_handle(item);
const unsigned char *data = cbor_bytestring_handle(item);
fprintf(out, "Definite, length %zuB\n", cbor_bytestring_length(item));
fprintf(out, "%*s", indent + 4, " ");
for (size_t i = 0; i < cbor_bytestring_length(item); i++)
Expand Down
7 changes: 5 additions & 2 deletions test/pretty_printer_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ static void test_definite_bytestring(void **_CBOR_UNUSED(_state)) {
cbor_item_t *item = cbor_build_bytestring(data, 3);
char *expected[] = {
"[CBOR_TYPE_BYTESTRING] Definite, length 3B",
" 010203",
};
assert_describe_result(item, expected, 1);
assert_describe_result(item, expected, 2);
cbor_decref(&item);
}

Expand All @@ -70,9 +71,11 @@ static void test_indefinite_bytestring(void **_CBOR_UNUSED(_state)) {
char *expected[] = {
"[CBOR_TYPE_BYTESTRING] Indefinite, with 2 chunks:",
" [CBOR_TYPE_BYTESTRING] Definite, length 3B",
" 010203",
" [CBOR_TYPE_BYTESTRING] Definite, length 2B",
" 0102",
};
assert_describe_result(item, expected, 3);
assert_describe_result(item, expected, 5);
cbor_decref(&item);
}

Expand Down

0 comments on commit 8340b01

Please sign in to comment.