Skip to content

Commit 9476b85

Browse files
committed
Add real hyp2f1 tests
1 parent bc4ca96 commit 9476b85

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

tests/test_hyp2f1.cpp

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,40 @@ TEST_CASE("hyp2f1 complex scipy.special cases", "[hyp2f1][complex][scipy-special
2828
auto [desired, fallback] = output;
2929
auto out = xsf::hyp2f1(a, b, c, z);
3030
auto error = xsf::extended_relative_error(out, desired);
31+
tol = adjust_tolerance(tol);
3132
INFO("a := " << std::setprecision(std::numeric_limits<double>::max_digits10) << a << '\n'
3233
<< "b := " << b << '\n'
3334
<< "c := " << c << '\n'
3435
<< "z := " << z << '\n'
3536
<< "out := " << out << '\n'
3637
<< "desired := " << desired << '\n'
3738
<< "error := " << error << '\n'
38-
<< "tolerance := " << 2*tol << '\n'
39+
<< "tolerance := " << tol << '\n'
3940
);
40-
REQUIRE(error < 2*tol);
41+
REQUIRE(error <= tol);
42+
}
43+
44+
TEST_CASE("hyp2f1 real scipy.special cases", "[hyp2f1][real][scipy-special]") {
45+
auto [input, output, tol] = GENERATE(
46+
xsf_test_cases<
47+
std::tuple<double, double, double, double>, std::tuple<double, bool>, double>(
48+
hyp2f1_tables_path / "In_d_d_d_d-d.parquet", hyp2f1_tables_path / "Out_d_d_d_d-d.parquet",
49+
hyp2f1_tables_path / "Err_d_d_d_d-d_gcc-linux-x86_64.parquet"
50+
)
51+
);
52+
auto [a, b, c, z] = input;
53+
auto [desired, fallback] = output;
54+
auto out = xsf::hyp2f1(a, b, c, z);
55+
auto error = xsf::extended_relative_error(out, desired);
56+
tol = adjust_tolerance(tol);
57+
INFO("a := " << std::setprecision(std::numeric_limits<double>::max_digits10) << a << '\n'
58+
<< "b := " << b << '\n'
59+
<< "c := " << c << '\n'
60+
<< "z := " << z << '\n'
61+
<< "out := " << out << '\n'
62+
<< "desired := " << desired << '\n'
63+
<< "error := " << error << '\n'
64+
<< "tolerance := " << tol << '\n'
65+
);
66+
REQUIRE(error <= tol);
4167
}

0 commit comments

Comments
 (0)