File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,31 @@ void test()
7979inline void test_overflow_path ()
8080{
8181 const std::string str {" INF" };
82+
83+ #ifndef BOOST_DECIMAL_DISABLE_EXCEPTIONS
84+
8285 BOOST_TEST_THROWS (recover_value<decimal32_t >(str, nullptr ), std::out_of_range);
86+
87+ #else
88+
89+ BOOST_TEST (isnan (recover_value<decimal32_t >(str, nullptr )));
90+
91+ #endif
92+ }
93+
94+ inline void test_invalid_path ()
95+ {
96+ const std::string str {" JUNK" };
97+
98+ #ifndef BOOST_DECIMAL_DISABLE_EXCEPTIONS
99+
100+ BOOST_TEST_THROWS (recover_value<decimal32_t >(str, nullptr ), std::invalid_argument);
101+
102+ #else
103+
104+ BOOST_TEST (isnan (recover_value<decimal32_t >(str, nullptr )));
105+
106+ #endif
83107}
84108
85109int main ()
@@ -92,6 +116,7 @@ int main()
92116 test<decimal_fast128_t >();
93117
94118 test_overflow_path ();
119+ test_invalid_path ();
95120
96121 return boost::report_errors ();
97122}
You can’t perform that action at this time.
0 commit comments