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

Better tests #3

Closed
RaulPPelaez opened this issue Feb 12, 2024 · 0 comments · Fixed by #8
Closed

Better tests #3

RaulPPelaez opened this issue Feb 12, 2024 · 0 comments · Fixed by #8

Comments

@RaulPPelaez
Copy link
Contributor

Writing automated unit tests would take this repo to the next level.

The current tests are more "does it run" tests.

We could use pytest for the python side and GTest for the C++ part. Although the python side is just a wrapper for the C++ library, so the python tests would probably suffice in most cases for correctness, while the C++ ones we could leave as "does it run".

I have never found a really good way to test for correctness in these kind of codes. Normally I test some limits (for instance, "does the doubly periodic code reproduces an open boundary when Lz>>Lx,Ly?"), but that can hide subtle bugs because you cannot have a lot of digits of precision. Ideas are welcome!

See for instance how I test the FCM in UAMMD: https://github.com/RaulPPelaez/UAMMD/blob/455a271dd270722e0fd4c8019fe9cafc7958bd57/test/BDHI/FCM/fcm_test.cu#L77

In addition to that, we should set up a Github CI to run these tests automatically on every new commit/PR.
In practice this amounts to having a special script in the repo that will compile and run the tests on a GH-provided machine. See for instance here https://github.com/openmm/openmm-torch/blob/master/.github/workflows/CI.yml

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 a pull request may close this issue.

1 participant