From 2b39efd545370e2f349fca143d95b03cf5767fe9 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 5 May 2020 12:59:57 +0200 Subject: [PATCH] :white_check_mark: add tests for binary type --- test/src/unit-cbor.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/src/unit-cbor.cpp b/test/src/unit-cbor.cpp index 01379041..4f0954da 100644 --- a/test/src/unit-cbor.cpp +++ b/test/src/unit-cbor.cpp @@ -1428,6 +1428,20 @@ TEST_CASE("CBOR") CHECK(json::from_cbor(result, true, false) == j); } } + + SECTION("binary in array") + { + // array with three empty byte strings + std::vector input = {0x83, 0x40, 0x40, 0x40}; + CHECK_NOTHROW(json::from_cbor(input)); + } + + SECTION("binary in object") + { + // object mapping "foo" to empty byte string + std::vector input = {0xA1, 0x63, 0x66, 0x6F, 0x6F, 0x40}; + CHECK_NOTHROW(json::from_cbor(input)); + } } }