fix clang-tidy else after return

+ add test case that triggers fallthrough in from_json
+ re-amalgamate
This commit is contained in:
Jonas Wittbrodt 2021-08-25 15:31:09 +02:00
parent 75bd0a8762
commit 3dce62b5f7
3 changed files with 5 additions and 4 deletions

View File

@ -65,7 +65,7 @@ void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val)
break;
}
// LCOV_EXCL_START
else if (std::numeric_limits<ArithmeticType>::has_quiet_NaN)
if (std::numeric_limits<ArithmeticType>::has_quiet_NaN)
{
val = std::numeric_limits<ArithmeticType>::quiet_NaN();
break;
@ -371,7 +371,7 @@ void from_json(const BasicJsonType& j, ArithmeticType& val)
break;
}
// LCOV_EXCL_START
else if (std::numeric_limits<ArithmeticType>::has_quiet_NaN)
if (std::numeric_limits<ArithmeticType>::has_quiet_NaN)
{
val = std::numeric_limits<ArithmeticType>::quiet_NaN();
break;

View File

@ -3928,7 +3928,7 @@ void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val)
break;
}
// LCOV_EXCL_START
else if (std::numeric_limits<ArithmeticType>::has_quiet_NaN)
if (std::numeric_limits<ArithmeticType>::has_quiet_NaN)
{
val = std::numeric_limits<ArithmeticType>::quiet_NaN();
break;
@ -4234,7 +4234,7 @@ void from_json(const BasicJsonType& j, ArithmeticType& val)
break;
}
// LCOV_EXCL_START
else if (std::numeric_limits<ArithmeticType>::has_quiet_NaN)
if (std::numeric_limits<ArithmeticType>::has_quiet_NaN)
{
val = std::numeric_limits<ArithmeticType>::quiet_NaN();
break;

View File

@ -936,6 +936,7 @@ TEST_CASE("value conversion")
{
CHECK_THROWS_AS(json(json::value_t::null).get<json::number_integer_t>(),
json::type_error&);
CHECK_THROWS_AS(json(json::value_t::null).get<short>(), json::type_error&);
CHECK_THROWS_AS(json(json::value_t::object).get<json::number_integer_t>(),
json::type_error&);
CHECK_THROWS_AS(json(json::value_t::array).get<json::number_integer_t>(),