From 8340b0111ce0f6080498064a369ae968a3044b6c Mon Sep 17 00:00:00 2001 From: Pavel Kalvoda Date: Sat, 3 Jun 2023 15:32:47 +0200 Subject: [PATCH] Update cbor_describe after #281 --- src/cbor.c | 2 +- test/pretty_printer_test.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cbor.c b/src/cbor.c index 1de49cd..61209a1 100644 --- a/src/cbor.c +++ b/src/cbor.c @@ -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++) diff --git a/test/pretty_printer_test.c b/test/pretty_printer_test.c index f77f029..e1fc857 100644 --- a/test/pretty_printer_test.c +++ b/test/pretty_printer_test.c @@ -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); } @@ -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); }