From 2537677e4ca608b667d120f2f136b0f301081a93 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 20 Mar 2018 23:40:01 +0100 Subject: [PATCH] :white_check_mark: improved test coverage --- test/src/unit-ubjson.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/src/unit-ubjson.cpp b/test/src/unit-ubjson.cpp index 7f92d969..1ccb9e22 100644 --- a/test/src/unit-ubjson.cpp +++ b/test/src/unit-ubjson.cpp @@ -1664,6 +1664,16 @@ TEST_CASE("UBJSON") CHECK_THROWS_AS(json::from_ubjson(v3), json::parse_error&); CHECK_THROWS_WITH(json::from_ubjson(v3), "[json.exception.parse_error.110] parse error at 5: unexpected end of input"); CHECK(json::from_ubjson(v3, true, false).is_discarded()); + + std::vector vST1 = {'{', '$', 'd', '#', 'i', 2, 'i', 1, 'a'}; + CHECK_THROWS_AS(json::from_ubjson(vST1), json::parse_error&); + CHECK_THROWS_WITH(json::from_ubjson(vST1), "[json.exception.parse_error.110] parse error at 10: unexpected end of input"); + CHECK(json::from_ubjson(vST1, true, false).is_discarded()); + + std::vector vST2 = {'{', '#', 'i', 2, 'i', 1, 'a'}; + CHECK_THROWS_AS(json::from_ubjson(vST2), json::parse_error&); + CHECK_THROWS_WITH(json::from_ubjson(vST2), "[json.exception.parse_error.110] parse error at 8: unexpected end of input"); + CHECK(json::from_ubjson(vST2, true, false).is_discarded()); } }