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

Template boilerplate tests #2103

Open
albinahlback opened this issue Oct 27, 2024 · 2 comments
Open

Template boilerplate tests #2103

albinahlback opened this issue Oct 27, 2024 · 2 comments

Comments

@albinahlback
Copy link
Collaborator

We should probably make templates for tests. Not sure how to go about this nicely.

As Max discovered in #2102, we do not test certain cases for some functions (in this example it was the zero polynomial minus a zero integer that is never tested, which did crash).

While all functions are tested with "hardcoded" test code (where some actually need it), for sort of more boilerplaty functions it becomes harder to go get a good overview of the code when everything is "hardcoded". It could also be more prone to errors, such as this case.

Hence, I would strongly suggest we look into templating boilerplate tests.

@fredrik-johansson
Copy link
Collaborator

fredrik-johansson commented Oct 28, 2024

Note that this bug would probably have been caught by the generic ring tests if the _fmpz variants were wrapped in https://github.com/flintlib/flint/blob/main/src/gr/fmpz_poly.c

Edit: it isn't caught, because of the way the test code is written. The problematic input isn't specifically the zero polynomial, but a polynomial with zero alloc, and this doesn't get caught because the test code reuses variables and never tests sub_fmpz with a freshly allocated variable. Note that we need to do both cases: we've had plenty of bugs for the case where the output variables is not freshly initialized, which the test code didn't cover.

@albinahlback
Copy link
Collaborator Author

I think it sounds very reasonable to do this through GR!

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

No branches or pull requests

2 participants