From 81a42724445c54a4d3574a36f349106e1ba903d8 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 7 Dec 2016 23:14:37 +0100 Subject: [PATCH] :white_check_mark: more test cases for CBOR --- test/src/unit-cbor.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/src/unit-cbor.cpp b/test/src/unit-cbor.cpp index bbf47bc30..4fa2f1260 100644 --- a/test/src/unit-cbor.cpp +++ b/test/src/unit-cbor.cpp @@ -629,6 +629,21 @@ TEST_CASE("CBOR") CHECK(json::from_cbor(result) == j); } } + + SECTION("half-precision float (edge cases)") + { + SECTION("infinity") + { + json j = json::from_cbor(std::vector({0xf9, 0x7c, 0x00})); + CHECK(j == nullptr); + } + + SECTION("NaN") + { + json j = json::from_cbor(std::vector({0xf9, 0x7c, 0x01})); + CHECK(j == nullptr); + } + } } SECTION("string")