78{
79 const auto test_cfg = cfg["test_funcs"]["test_get_rand"];
80
81 const std::vector<std::pair<int, int>> to_assert_int
82 = get_as<std::vector<std::pair<int, int>>>("vals_int", test_cfg);
83 for(const auto& val: to_assert_int) {
84 const int rand = get_rand<int>(val, *rng);
85 BOOST_TEST(rand >= val.first);
86 BOOST_TEST(rand <= val.second);
87 }
88
89 const std::vector<std::pair<double, double>> to_assert_double
90 = get_as<std::vector<std::pair<double, double>>>("vals_double",
91 test_cfg);
92 for(const auto& val: to_assert_int) {
93 const double rand = get_rand<double>(val, *rng);
94 BOOST_TEST(rand >= val.first);
95 BOOST_TEST(rand <= val.second);
96 }
97
98 const std::vector<std::pair<double, double>> to_assert_fail
99 = get_as<std::vector<std::pair<double, double>>>("assert_fail",
100 test_cfg);
101 for(const auto& val: to_assert_fail) {
102 TestTools::check_exception<std::invalid_argument>(
103 [&](){
104 get_rand<double>(val, *rng);
105 },
106 "Error, invalid parameter range! Upper limit has to be "
107 "higher than the lower limit."
108 );
109 }
110}