Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: Add data driven tests based on xsref parquet files using Catch2 #14

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

steppi
Copy link
Collaborator

@steppi steppi commented Mar 11, 2025

This PR is a rough sketch of what I'm thinking of for tests. It uses Catch2 as the testing framework, and implements a custom Catch2 generator to iterate through test cases. Tests are only implemented for hyp2f1 on this PR. Once I have everything settled down, I plan to write a script to generate the test files for other functions since they follow a pretty straightforward recipe. I've only added tests for 64 bit Linux GCC, but more can come later. I'll need to add a parquet file of tolerances for every tested platform, but this shouldn't be too bad actually.

I think Catch2 seems nice enough to work with. So far I've found one thing that it would be good to have fixed. It seems that all floating point numbers are printed with std::fixed when using Catch2's built in logging features, when std::scientific is needed for our case in order to actual see floating point values to full precision. There's a languishing PR, catchorg/Catch2#2226, to allow setting the format to std::scientific, which only needs a small tweak to make work. I see this as a bellweather. If I'm able to nudge this PR through on a reasonable timescale, then I think Catch2 is actively developed enough to be worth using here, but if the PR continues to languish, I guess we can just use GoogleTest or something. I'll leave a comment with more details on this.

I haven't done any of the nice stuff with coverage that @inkydragon did. This is important, but this is just a sketch for now. @inkydragon, let me know if you think there's anything else that could be improved here. It also might be a good idea to set up ccache.

I'm not sure if github workflow i wrote will work yet. I still haven't got up to speed on testing those locally. The tests themselves due work locally for me though.

Comment on lines +32 to +40
INFO("a := " << std::setprecision(std::numeric_limits<double>::max_digits10) << a << '\n'
<< "b := " << b << '\n'
<< "c := " << c << '\n'
<< "z := " << z << '\n'
<< "out := " << out << '\n'
<< "desired := " << desired << '\n'
<< "error := " << error << '\n'
<< "tolerance := " << tol << '\n'
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If catchorg/Catch2#2226 lands. This could be replaced with

CAPTURE(a, b, c, z, out, desired, error, tolerance);

@steppi steppi closed this Mar 11, 2025
@steppi steppi reopened this Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant