From: Gereon Kremer Date: Wed, 8 Dec 2021 00:14:55 +0000 (-0800) Subject: Improve options tests (#7761) X-Git-Tag: cvc5-1.0.0~707 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2544e68bb28b2df9c1eb231008e3a4e2719c2d1a;p=cvc5.git Improve options tests (#7761) This PR adds unit tests for a few more corners of the options code. --- diff --git a/test/unit/options/options_black.cpp b/test/unit/options/options_black.cpp index 1ab4bce23..0aa160677 100644 --- a/test/unit/options/options_black.cpp +++ b/test/unit/options/options_black.cpp @@ -92,11 +92,13 @@ TEST_F(TestBlackOptions, set) } EXPECT_NO_THROW(d_solver.setOption( name, std::to_string((range.first + range.second) / 2))); + EXPECT_THROW(d_solver.setOption(name, "0123abc"), CVC5ApiOptionException); }, [this, &name](const OptionInfo::NumberInfo& v) { std::pair range{ std::numeric_limits::min(), std::numeric_limits::max()}; + EXPECT_THROW(d_solver.setOption(name, "-1"), CVC5ApiOptionException); if (v.minimum) { EXPECT_THROW( @@ -117,6 +119,7 @@ TEST_F(TestBlackOptions, set) } EXPECT_NO_THROW(d_solver.setOption( name, std::to_string((range.first + range.second) / 2))); + EXPECT_THROW(d_solver.setOption(name, "0123abc"), CVC5ApiOptionException); }, [this, &name](const OptionInfo::NumberInfo& v) { std::pair range{ @@ -149,7 +152,9 @@ TEST_F(TestBlackOptions, set) for (const auto& m : v.modes) { d_solver.setOption(name, m); + EXPECT_EQ(d_solver.getOption(name), m); } + EXPECT_DEATH(d_solver.setOption(name, "help"), ""); }, }, info.valueInfo);