File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,6 @@ TEST(NumericCast, UnsignedToSignedOverflow) {
100100}
101101
102102TEST (NumericCast, FloatingPointOverflow) {
103- // / [Sample utils::numeric_cast usage]
104103 using FloatLimits = std::numeric_limits<float >;
105104
106105 EXPECT_EQ (utils::numeric_cast<float >(double (FloatLimits::max ())), FloatLimits::max ());
@@ -116,10 +115,11 @@ TEST(NumericCast, FloatingPointOverflow) {
116115 using DoubleLimits = std::numeric_limits<double >;
117116
118117 EXPECT_EQ (utils::numeric_cast<double >(static_cast <long double >(DoubleLimits::max ())), DoubleLimits::max ());
119- EXPECT_THROW (utils::numeric_cast<double >(2 .0L * DoubleLimits::max ()), std::runtime_error);
120118 EXPECT_EQ (utils::numeric_cast<double >(static_cast <long double >(DoubleLimits::lowest ())), DoubleLimits::lowest ());
121- EXPECT_THROW (utils::numeric_cast<double >(2 .0L * DoubleLimits::lowest ()), std::runtime_error);
122- // / [Sample utils::numeric_cast usage]
119+ if constexpr (sizeof (double ) < sizeof (long double )) {
120+ EXPECT_THROW (utils::numeric_cast<double >(2 .0L * DoubleLimits::max ()), std::runtime_error);
121+ EXPECT_THROW (utils::numeric_cast<double >(2 .0L * DoubleLimits::lowest ()), std::runtime_error);
122+ }
123123}
124124
125125} // namespace
You can’t perform that action at this time.
0 commit comments