test: check if an exception is thrown by overflow

This commit is contained in:
ToruNiina
2022-06-08 00:40:28 +09:00
parent 12d0dbc6f4
commit d6efdf7d9e
2 changed files with 19 additions and 0 deletions

View File

@@ -176,3 +176,10 @@ BOOST_AUTO_TEST_CASE(test_nan)
BOOST_CHECK(std::isnan(r.unwrap().first));
}
}
BOOST_AUTO_TEST_CASE(test_overflow)
{
std::istringstream float_overflow (std::string("float-overflow = 1.0e+1024"));
BOOST_CHECK_THROW(toml::parse(float_overflow ), toml::syntax_error);
// istringstream >> float does not set failbit in case of underflow.
}