From 2544e68bb28b2df9c1eb231008e3a4e2719c2d1a Mon Sep 17 00:00:00 2001 From: Gereon Kremer Date: Tue, 7 Dec 2021 16:14:55 -0800 Subject: [PATCH] Improve options tests (#7761) This PR adds unit tests for a few more corners of the options code. --- test/unit/options/options_black.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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); -- 2.30.2