Skip to content

Commit 9d18705

Browse files
committed
MAINT: Add tests for additional type signatures
1 parent a544ee2 commit 9d18705

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1071
-0
lines changed

tests/scipy_special_tests/test_airy.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,44 @@ TEST_CASE("airy D->DDDD scipy_special_tests", "[airy][D->DDDD][scipy_special_tes
4949
CAPTURE(z, out3, desired3, error3, tol3, fallback);
5050
REQUIRE(error3 <= tol3);
5151
}
52+
53+
TEST_CASE("airy d->dddd scipy_special_tests", "[airy][d->dddd][scipy_special_tests]") {
54+
SET_FP_FORMAT()
55+
auto [input, output, tol] =
56+
GENERATE(xsf_test_cases<
57+
double, std::tuple<double, double, double, double, bool>, std::tuple<double, double, double, double>>(
58+
tables_path / "In_d-d_d_d_d.parquet", tables_path / "Out_d-d_d_d_d.parquet",
59+
tables_path / ("Err_d-d_d_d_d_" + get_platform_str() + ".parquet")
60+
));
61+
62+
auto z = input;
63+
auto [desired0, desired1, desired2, desired3, fallback] = output;
64+
65+
double out0;
66+
double out1;
67+
double out2;
68+
double out3;
69+
70+
xsf::airy(z, out0, out1, out2, out3);
71+
auto [tol0, tol1, tol2, tol3] = tol;
72+
73+
auto error0 = xsf::extended_relative_error(out0, desired0);
74+
tol0 = adjust_tolerance(tol0);
75+
CAPTURE(z, out0, desired0, error0, tol0, fallback);
76+
REQUIRE(error0 <= tol0);
77+
78+
auto error1 = xsf::extended_relative_error(out1, desired1);
79+
tol1 = adjust_tolerance(tol1);
80+
CAPTURE(z, out1, desired1, error1, tol1, fallback);
81+
REQUIRE(error1 <= tol1);
82+
83+
auto error2 = xsf::extended_relative_error(out2, desired2);
84+
tol2 = adjust_tolerance(tol2);
85+
CAPTURE(z, out2, desired2, error2, tol2, fallback);
86+
REQUIRE(error2 <= tol2);
87+
88+
auto error3 = xsf::extended_relative_error(out3, desired3);
89+
tol3 = adjust_tolerance(tol3);
90+
CAPTURE(z, out3, desired3, error3, tol3, fallback);
91+
REQUIRE(error3 <= tol3);
92+
}

tests/scipy_special_tests/test_airye.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,44 @@ TEST_CASE("airye D->DDDD scipy_special_tests", "[airye][D->DDDD][scipy_special_t
4949
CAPTURE(z, out3, desired3, error3, tol3, fallback);
5050
REQUIRE(error3 <= tol3);
5151
}
52+
53+
TEST_CASE("airye d->dddd scipy_special_tests", "[airye][d->dddd][scipy_special_tests]") {
54+
SET_FP_FORMAT()
55+
auto [input, output, tol] =
56+
GENERATE(xsf_test_cases<
57+
double, std::tuple<double, double, double, double, bool>, std::tuple<double, double, double, double>>(
58+
tables_path / "In_d-d_d_d_d.parquet", tables_path / "Out_d-d_d_d_d.parquet",
59+
tables_path / ("Err_d-d_d_d_d_" + get_platform_str() + ".parquet")
60+
));
61+
62+
auto z = input;
63+
auto [desired0, desired1, desired2, desired3, fallback] = output;
64+
65+
double out0;
66+
double out1;
67+
double out2;
68+
double out3;
69+
70+
xsf::airye(z, out0, out1, out2, out3);
71+
auto [tol0, tol1, tol2, tol3] = tol;
72+
73+
auto error0 = xsf::extended_relative_error(out0, desired0);
74+
tol0 = adjust_tolerance(tol0);
75+
CAPTURE(z, out0, desired0, error0, tol0, fallback);
76+
REQUIRE(error0 <= tol0);
77+
78+
auto error1 = xsf::extended_relative_error(out1, desired1);
79+
tol1 = adjust_tolerance(tol1);
80+
CAPTURE(z, out1, desired1, error1, tol1, fallback);
81+
REQUIRE(error1 <= tol1);
82+
83+
auto error2 = xsf::extended_relative_error(out2, desired2);
84+
tol2 = adjust_tolerance(tol2);
85+
CAPTURE(z, out2, desired2, error2, tol2, fallback);
86+
REQUIRE(error2 <= tol2);
87+
88+
auto error3 = xsf::extended_relative_error(out3, desired3);
89+
tol3 = adjust_tolerance(tol3);
90+
CAPTURE(z, out3, desired3, error3, tol3, fallback);
91+
REQUIRE(error3 <= tol3);
92+
}

tests/scipy_special_tests/test_bdtr.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,20 @@ TEST_CASE("bdtr dpd->d scipy_special_tests", "[bdtr][dpd->d][scipy_special_tests
2222
CAPTURE(k, n, p, out, desired, error, tol, fallback);
2323
REQUIRE(error <= tol);
2424
}
25+
26+
TEST_CASE("bdtr ddd->d scipy_special_tests", "[bdtr][ddd->d][scipy_special_tests]") {
27+
SET_FP_FORMAT()
28+
auto [input, output, tol] =
29+
GENERATE(xsf_test_cases<std::tuple<double, double, double>, std::tuple<double, bool>, double>(
30+
tables_path / "In_d_d_d-d.parquet", tables_path / "Out_d_d_d-d.parquet",
31+
tables_path / ("Err_d_d_d-d_" + get_platform_str() + ".parquet")
32+
));
33+
34+
auto [k, n, p] = input;
35+
auto [desired, fallback] = output;
36+
auto out = xsf::bdtr(k, n, p);
37+
auto error = xsf::extended_relative_error(out, desired);
38+
tol = adjust_tolerance(tol);
39+
CAPTURE(k, n, p, out, desired, error, tol, fallback);
40+
REQUIRE(error <= tol);
41+
}

tests/scipy_special_tests/test_bdtrc.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,20 @@ TEST_CASE("bdtrc dpd->d scipy_special_tests", "[bdtrc][dpd->d][scipy_special_tes
2222
CAPTURE(k, n, p, out, desired, error, tol, fallback);
2323
REQUIRE(error <= tol);
2424
}
25+
26+
TEST_CASE("bdtrc ddd->d scipy_special_tests", "[bdtrc][ddd->d][scipy_special_tests]") {
27+
SET_FP_FORMAT()
28+
auto [input, output, tol] =
29+
GENERATE(xsf_test_cases<std::tuple<double, double, double>, std::tuple<double, bool>, double>(
30+
tables_path / "In_d_d_d-d.parquet", tables_path / "Out_d_d_d-d.parquet",
31+
tables_path / ("Err_d_d_d-d_" + get_platform_str() + ".parquet")
32+
));
33+
34+
auto [k, n, p] = input;
35+
auto [desired, fallback] = output;
36+
auto out = xsf::bdtrc(k, n, p);
37+
auto error = xsf::extended_relative_error(out, desired);
38+
tol = adjust_tolerance(tol);
39+
CAPTURE(k, n, p, out, desired, error, tol, fallback);
40+
REQUIRE(error <= tol);
41+
}

tests/scipy_special_tests/test_bdtri.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,20 @@ TEST_CASE("bdtri dpd->d scipy_special_tests", "[bdtri][dpd->d][scipy_special_tes
2222
CAPTURE(k, n, y, out, desired, error, tol, fallback);
2323
REQUIRE(error <= tol);
2424
}
25+
26+
TEST_CASE("bdtri ddd->d scipy_special_tests", "[bdtri][ddd->d][scipy_special_tests]") {
27+
SET_FP_FORMAT()
28+
auto [input, output, tol] =
29+
GENERATE(xsf_test_cases<std::tuple<double, double, double>, std::tuple<double, bool>, double>(
30+
tables_path / "In_d_d_d-d.parquet", tables_path / "Out_d_d_d-d.parquet",
31+
tables_path / ("Err_d_d_d-d_" + get_platform_str() + ".parquet")
32+
));
33+
34+
auto [k, n, y] = input;
35+
auto [desired, fallback] = output;
36+
auto out = xsf::bdtri(k, n, y);
37+
auto error = xsf::extended_relative_error(out, desired);
38+
tol = adjust_tolerance(tol);
39+
CAPTURE(k, n, y, out, desired, error, tol, fallback);
40+
REQUIRE(error <= tol);
41+
}

tests/scipy_special_tests/test_chdtr.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,19 @@ TEST_CASE("chdtr dd->d scipy_special_tests", "[chdtr][dd->d][scipy_special_tests
2121
CAPTURE(v, x, out, desired, error, tol, fallback);
2222
REQUIRE(error <= tol);
2323
}
24+
25+
TEST_CASE("chdtr ff->f scipy_special_tests", "[chdtr][ff->f][scipy_special_tests]") {
26+
SET_FP_FORMAT()
27+
auto [input, output, tol] = GENERATE(xsf_test_cases<std::tuple<float, float>, std::tuple<float, bool>, float>(
28+
tables_path / "In_f_f-f.parquet", tables_path / "Out_f_f-f.parquet",
29+
tables_path / ("Err_f_f-f_" + get_platform_str() + ".parquet")
30+
));
31+
32+
auto [v, x] = input;
33+
auto [desired, fallback] = output;
34+
auto out = xsf::chdtr(v, x);
35+
auto error = xsf::extended_relative_error(out, desired);
36+
tol = adjust_tolerance(tol);
37+
CAPTURE(v, x, out, desired, error, tol, fallback);
38+
REQUIRE(error <= tol);
39+
}

tests/scipy_special_tests/test_chdtrc.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,19 @@ TEST_CASE("chdtrc dd->d scipy_special_tests", "[chdtrc][dd->d][scipy_special_tes
2121
CAPTURE(v, x, out, desired, error, tol, fallback);
2222
REQUIRE(error <= tol);
2323
}
24+
25+
TEST_CASE("chdtrc ff->f scipy_special_tests", "[chdtrc][ff->f][scipy_special_tests]") {
26+
SET_FP_FORMAT()
27+
auto [input, output, tol] = GENERATE(xsf_test_cases<std::tuple<float, float>, std::tuple<float, bool>, float>(
28+
tables_path / "In_f_f-f.parquet", tables_path / "Out_f_f-f.parquet",
29+
tables_path / ("Err_f_f-f_" + get_platform_str() + ".parquet")
30+
));
31+
32+
auto [v, x] = input;
33+
auto [desired, fallback] = output;
34+
auto out = xsf::chdtrc(v, x);
35+
auto error = xsf::extended_relative_error(out, desired);
36+
tol = adjust_tolerance(tol);
37+
CAPTURE(v, x, out, desired, error, tol, fallback);
38+
REQUIRE(error <= tol);
39+
}

tests/scipy_special_tests/test_cospi.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,19 @@ TEST_CASE("cospi D->D scipy_special_tests", "[cospi][D->D][scipy_special_tests]"
2222
CAPTURE(x, out, desired, error, tol, fallback);
2323
REQUIRE(error <= tol);
2424
}
25+
26+
TEST_CASE("cospi d->d scipy_special_tests", "[cospi][d->d][scipy_special_tests]") {
27+
SET_FP_FORMAT()
28+
auto [input, output, tol] = GENERATE(xsf_test_cases<double, std::tuple<double, bool>, double>(
29+
tables_path / "In_d-d.parquet", tables_path / "Out_d-d.parquet",
30+
tables_path / ("Err_d-d_" + get_platform_str() + ".parquet")
31+
));
32+
33+
auto x = input;
34+
auto [desired, fallback] = output;
35+
auto out = xsf::cospi(x);
36+
auto error = xsf::extended_relative_error(out, desired);
37+
tol = adjust_tolerance(tol);
38+
CAPTURE(x, out, desired, error, tol, fallback);
39+
REQUIRE(error <= tol);
40+
}

tests/scipy_special_tests/test_cyl_bessel_i.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,21 @@ TEST_CASE("cyl_bessel_i dd->d scipy_special_tests", "[cyl_bessel_i][dd->d][scipy
2121
CAPTURE(v, z, out, desired, error, tol, fallback);
2222
REQUIRE(error <= tol);
2323
}
24+
25+
TEST_CASE("cyl_bessel_i dD->D scipy_special_tests", "[cyl_bessel_i][dD->D][scipy_special_tests]") {
26+
SET_FP_FORMAT()
27+
auto [input, output, tol] = GENERATE(
28+
xsf_test_cases<std::tuple<double, std::complex<double>>, std::tuple<std::complex<double>, bool>, double>(
29+
tables_path / "In_d_cd-cd.parquet", tables_path / "Out_d_cd-cd.parquet",
30+
tables_path / ("Err_d_cd-cd_" + get_platform_str() + ".parquet")
31+
)
32+
);
33+
34+
auto [v, z] = input;
35+
auto [desired, fallback] = output;
36+
auto out = xsf::cyl_bessel_i(v, z);
37+
auto error = xsf::extended_relative_error(out, desired);
38+
tol = adjust_tolerance(tol);
39+
CAPTURE(v, z, out, desired, error, tol, fallback);
40+
REQUIRE(error <= tol);
41+
}

tests/scipy_special_tests/test_cyl_bessel_i0.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,19 @@ TEST_CASE("cyl_bessel_i0 f->f scipy_special_tests", "[cyl_bessel_i0][f->f][scipy
2121
CAPTURE(z, out, desired, error, tol, fallback);
2222
REQUIRE(error <= tol);
2323
}
24+
25+
TEST_CASE("cyl_bessel_i0 d->d scipy_special_tests", "[cyl_bessel_i0][d->d][scipy_special_tests]") {
26+
SET_FP_FORMAT()
27+
auto [input, output, tol] = GENERATE(xsf_test_cases<double, std::tuple<double, bool>, double>(
28+
tables_path / "In_d-d.parquet", tables_path / "Out_d-d.parquet",
29+
tables_path / ("Err_d-d_" + get_platform_str() + ".parquet")
30+
));
31+
32+
auto z = input;
33+
auto [desired, fallback] = output;
34+
auto out = xsf::cyl_bessel_i0(z);
35+
auto error = xsf::extended_relative_error(out, desired);
36+
tol = adjust_tolerance(tol);
37+
CAPTURE(z, out, desired, error, tol, fallback);
38+
REQUIRE(error <= tol);
39+
}

0 commit comments

Comments
 (0)