mirror of
https://github.com/nlohmann/json.git
synced 2024-12-11 11:19:03 +08:00
✅ improved test coverage
This commit is contained in:
parent
da97cf7895
commit
7410763731
@ -1224,6 +1224,13 @@ TEST_CASE("CBOR")
|
|||||||
|
|
||||||
SECTION("errors")
|
SECTION("errors")
|
||||||
{
|
{
|
||||||
|
SECTION("empty byte vector")
|
||||||
|
{
|
||||||
|
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>()), json::parse_error&);
|
||||||
|
CHECK_THROWS_WITH(json::from_cbor(std::vector<uint8_t>()),
|
||||||
|
"[json.exception.parse_error.110] parse error at 1: unexpected end of input");
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("too short byte vector")
|
SECTION("too short byte vector")
|
||||||
{
|
{
|
||||||
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x18})), json::parse_error&);
|
CHECK_THROWS_AS(json::from_cbor(std::vector<uint8_t>({0x18})), json::parse_error&);
|
||||||
|
@ -1014,6 +1014,13 @@ TEST_CASE("MessagePack")
|
|||||||
|
|
||||||
SECTION("errors")
|
SECTION("errors")
|
||||||
{
|
{
|
||||||
|
SECTION("empty byte vector")
|
||||||
|
{
|
||||||
|
CHECK_THROWS_AS(json::from_msgpack(std::vector<uint8_t>()), json::parse_error&);
|
||||||
|
CHECK_THROWS_WITH(json::from_msgpack(std::vector<uint8_t>()),
|
||||||
|
"[json.exception.parse_error.110] parse error at 1: unexpected end of input");
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("too short byte vector")
|
SECTION("too short byte vector")
|
||||||
{
|
{
|
||||||
CHECK_THROWS_AS(json::from_msgpack(std::vector<uint8_t>({0xcc})), json::parse_error&);
|
CHECK_THROWS_AS(json::from_msgpack(std::vector<uint8_t>({0xcc})), json::parse_error&);
|
||||||
|
Loading…
Reference in New Issue
Block a user