Skip to content

Commit 108d71e

Browse files
committed
TST: add test for gh-92
1 parent 71da72e commit 108d71e

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

tests/xsf_tests/test_amos.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,35 @@ TEST_CASE("amos besj", "[amos][xsf_tests]") {
4949
REQUIRE(rel_error <= 1e-14);
5050
}
5151
}
52+
53+
TEST_CASE("amos besh vectorized", "[amos][xsf_tests]") {
54+
// tests the functionality of amos to return multiple consecutive orders for besh
55+
// by comparing to the versions returning only a single order
56+
using std::complex;
57+
58+
using test_case = std::tuple<complex<double>, double, int, int, int, double>;
59+
auto [z, fnu, kode, m, n, rtol] = GENERATE(
60+
test_case{complex{14.0, -3.0}, 1.0, 1, 1, 260, 4e-13} // gh-92
61+
);
62+
63+
std::vector<complex<double>> cy(n);
64+
int ierr = 0;
65+
int nz;
66+
67+
nz = xsf::amos::besh(z, fnu, kode, m, n, cy.data(), &ierr);
68+
69+
REQUIRE(ierr == 0);
70+
REQUIRE(nz == 0);
71+
72+
complex<double> ref;
73+
74+
for (int i = 0; i < n; ++i) {
75+
nz = xsf::amos::besh(z, fnu + i, kode, m, 1, &ref, &ierr);
76+
REQUIRE(ierr == 0);
77+
REQUIRE(nz == 0);
78+
79+
const auto rel_error = xsf::extended_relative_error(cy[i], ref);
80+
CAPTURE(i, cy[i], ref, rel_error);
81+
REQUIRE(rel_error <= rtol);
82+
}
83+
}

0 commit comments

Comments
 (0)