Welcome to pid-tests package !
pid-test provides tools to help writing unit tests using the Catch2 test framework
The main features of this package are:
- a
pid-tests
component that provides a precompiled main function for the Catch2 test framework and, optionally, the deamonize library if available. More info on thepid-tests
component here - a
PID_Test
CMake function that simplify the declaration of unit tests, available as long as a package dependency topid-tests
exists
The PID_Test CMake function
The PID_Test
function wraps the calls to PID_Component
and run_PID_Test
and is tailored for Catch2-based unit tests.
It also automatically link the test component with pid-tests
so you don’t have to do it yourself.
The function has the following signature:
PID_Test(
<args for PID_Component>
[CATCH2_OPTIONS ...]
[TESTS title1/filter1 title2/filter2 ...]
[SANITIZERS ALL|NONE|ADDRESS|LEAK|UNDEFINED]
)
In its most basic form, it can be a drop in replacement for PID_Component
, e.g before:
PID_Component(
my-test
...
)
run_PID_Test(
NAME my-test
COMPONENT my-test
)
After:
PID_Test(
my-test
...
)
But since Catch2 provides test filtering, it might be desirable to run multiple tests on the same component, selecting the parts to run with filter expressions.
To achieve this, you must describe each run with a title and a filter in the form title/filter and pass them to the TESTS
argument, e,g:
PID_Test(
my-test
...
TESTS
"math functions/math" # use double quotes if spaces are present
utilities/utils*
system/[fork][exec]
)
For more information on how to write filter expressions please refer to the official documentation.
If you wish to enable sanitizers for a specific test, you can pass them to the SANITIZERS
options.
These sanitizers will override the ones enabled in the project’s CMake options (e.g SANITIZE_ADDRESS
) for this test.
First steps
If your are a new user, you can start reading introduction section and installation instructions. Use the documentation tab to access useful resources to start working with the package.
To lean more about this site and how it is managed you can refer to this help page.