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

Use Catch2 for MMDevice/MMCore unit tests #420

Merged
merged 4 commits into from
Dec 22, 2023
Merged

Conversation

marktsuchida
Copy link
Member

This PR

  • Removes the MMDevice and MMCore unit tests from the Automake build
  • Replaces GoogleTest with Catch2 as the unit testing framework for those tests

in the hope of making it easier to add tests going forward.

The only way we run these tests in CI is via the experimental Meson build (using GitHub Actions), so there is not much point in maintaining the Automake-based way of running them (which is cumbersome to set up and does not have a Windows counterpart).

GoogleTest was the best option for C++98/03, but Catch2 is more popular with modern C++; it allows a natural syntax for assertions (auto-decomposes expressions) and requires very little boilerplate to reuse the setup or write parameterized tests (as can be seen by the changes to LoggingSplitEntryIntoLines-Tests.cpp in this PR). Hopefully this switch is not controversial (seeing that I seem to be the only person who has ever touched these tests).

There are a couple of device adapters that have unit tests (HamiltonMVP, UserDefinedSerial). These are left using GoogleTest and Automake for the time being.

We do not run these tests from CI using Automake currently, and there is
not much of an advantage in doing so because we now have them run using
the experimental Meson build for MMDevice and MMCore.

So remove from the Automake build so that these tests can be evolved
(including switching the testing framework away from GoogleTest) without
having to update the Automake build.

For the couple of device adapters that have unit tests, those can still
be run from Automake.
And use GoogleTest's default main() implementation.
@marktsuchida marktsuchida merged commit 108bc1b into main Dec 22, 2023
3 checks passed
@marktsuchida marktsuchida deleted the mmdevice-mmcore-tests branch December 22, 2023 21:55
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