|
| 1 | +#include "../testing_utils.h" |
| 2 | + |
| 3 | +#include <xsf/airy.h> |
| 4 | + |
| 5 | +namespace fs = std::filesystem; |
| 6 | + |
| 7 | +fs::path tables_path{fs::path(XSREF_TABLES_PATH) / "scipy_special_tests" / "airye"}; |
| 8 | + |
| 9 | +TEST_CASE("airye D->DDDD scipy_special_tests", "[airye][D->DDDD][scipy_special_tests]") { |
| 10 | + SET_FP_FORMAT() |
| 11 | + auto [input, output, tol] = GENERATE( |
| 12 | + xsf_test_cases< |
| 13 | + std::complex<double>, |
| 14 | + std::tuple<std::complex<double>, std::complex<double>, std::complex<double>, std::complex<double>, bool>, |
| 15 | + std::tuple<double, double, double, double>>( |
| 16 | + tables_path / "In_cd-cd_cd_cd_cd.parquet", tables_path / "Out_cd-cd_cd_cd_cd.parquet", |
| 17 | + tables_path / ("Err_cd-cd_cd_cd_cd_" + get_platform_str() + ".parquet") |
| 18 | + ) |
| 19 | + ); |
| 20 | + |
| 21 | + auto z = input; |
| 22 | + auto [desired0, desired1, desired2, desired3, fallback] = output; |
| 23 | + |
| 24 | + std::complex<double> out0; |
| 25 | + std::complex<double> out1; |
| 26 | + std::complex<double> out2; |
| 27 | + std::complex<double> out3; |
| 28 | + |
| 29 | + xsf::airye(z, out0, out1, out2, out3); |
| 30 | + auto [tol0, tol1, tol2, tol3] = tol; |
| 31 | + |
| 32 | + auto error0 = xsf::extended_relative_error(out0, desired0); |
| 33 | + tol0 = adjust_tolerance(tol0); |
| 34 | + CAPTURE(z, out0, desired0, error0, tol0, fallback); |
| 35 | + REQUIRE(error0 <= tol0); |
| 36 | + |
| 37 | + auto error1 = xsf::extended_relative_error(out1, desired1); |
| 38 | + tol1 = adjust_tolerance(tol1); |
| 39 | + CAPTURE(z, out1, desired1, error1, tol1, fallback); |
| 40 | + REQUIRE(error1 <= tol1); |
| 41 | + |
| 42 | + auto error2 = xsf::extended_relative_error(out2, desired2); |
| 43 | + tol2 = adjust_tolerance(tol2); |
| 44 | + CAPTURE(z, out2, desired2, error2, tol2, fallback); |
| 45 | + REQUIRE(error2 <= tol2); |
| 46 | + |
| 47 | + auto error3 = xsf::extended_relative_error(out3, desired3); |
| 48 | + tol3 = adjust_tolerance(tol3); |
| 49 | + CAPTURE(z, out3, desired3, error3, tol3, fallback); |
| 50 | + REQUIRE(error3 <= tol3); |
| 51 | +} |
0 commit comments