Fix warnings in unit tests (#91)

This commit is contained in:
Lee *!* Clagett 2024-01-22 14:17:38 -05:00 committed by Lee *!* Clagett
parent e477c174e2
commit d2ca5b4180

View file

@ -47,7 +47,7 @@ namespace
{
EXPECT(Target(0) == wire::integer::cast_unsigned<Target>(std::uintmax_t(0)));
EXPECT(limit::max() == wire::integer::cast_unsigned<Target>(std::uintmax_t(limit::max())));
if (limit::max() < max)
if constexpr (limit::max() < max)
{
EXPECT_THROWS_AS(wire::integer::cast_unsigned<Target>(std::uintmax_t(limit::max()) + 1), wire::exception);
EXPECT_THROWS_AS(wire::integer::cast_unsigned<Target>(max), wire::exception);
@ -68,7 +68,7 @@ namespace
SETUP("intmax_t to " + boost::core::demangle(typeid(Target).name()))
{
if (min < limit::min())
if constexpr (min < limit::min())
{
EXPECT_THROWS_AS(wire::integer::cast_signed<Target>(std::intmax_t(limit::min()) - 1), wire::exception);
EXPECT_THROWS_AS(wire::integer::cast_signed<Target>(min), wire::exception);
@ -76,7 +76,7 @@ namespace
EXPECT(limit::min() == wire::integer::cast_signed<Target>(std::intmax_t(limit::min())));
EXPECT(Target(0) == wire::integer::cast_signed<Target>(std::intmax_t(0)));
EXPECT(limit::max() == wire::integer::cast_signed<Target>(std::intmax_t(limit::max())));
if (limit::max() < max)
if constexpr (limit::max() < max)
{
EXPECT_THROWS_AS(wire::integer::cast_signed<Target>(std::intmax_t(limit::max()) + 1), wire::exception);
EXPECT_THROWS_AS(wire::integer::cast_signed<Target>(max), wire::exception);