29 namespace Test_Rational {
34 const std::string filename_input =
"test_Rational_Approx.yaml";
40 #ifdef USE_TESTMANAGER_AUTOREGISTER
42 #if defined(USE_GROUP_SU2)
62 const string str_vlevel = params_test.
get_string(
"verbose_level");
64 const bool do_check = params_test.
is_set(
"expected_result");
65 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
67 const int n_exp = params_rational.
get_int(
"exponent_numerator");
68 const int d_exp = params_rational.
get_int(
"exponent_denominator");
69 const double x_min = params_rational.
get_double(
"lower_bound");
70 const double x_max = params_rational.
get_double(
"upper_bound");
71 const int Npoint = params_rational.
get_int(
"number_of_partitions");
76 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
95 const double dx = (x_max - x_min) / Npoint;
96 const double p_exp = ((double)n_exp) / ((double)d_exp);
100 for (
int j = 0; j < Npoint + 1; ++j) {
101 double y1 = rational.
func(x);
102 double y2 = pow(x, p_exp);
104 vout.
general(vl,
"x,rational,x^(n/d) = %12.8f %12.8f %12.8f \n", x, y1, y2);
109 const double result = x;
117 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
const std::string test_name
void detailed(const char *format,...)
void general(const char *format,...)
void set_parameters(const Parameters ¶ms)
int get_int(const string &key) const
Determionation of coefficients of rational approximation.
Parameters lookup(const string &key) const
static bool RegisterTest(const std::string &key, const Test_function func)
double get_double(const string &key) const
bool is_set(const string &key) const
static void read(const std::string ¶ms_file, Parameters ¶ms)
int verify(const double result, const double expected, double eps)
string get_string(const string &key) const
void report(const Bridge::VerboseLevel vl=Bridge::GENERAL)
static VerboseLevel set_verbose_level(const std::string &str)
double func(const double x)