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:
pid-testscomponent that provides a precompiled main function for the Catch2 test framework and, optionally, the deamonize library if available. More info on the
PID_TestCMake function that simplify the declaration of unit tests, available as long as a package dependency to
Table of Contents
- The PID_Test CMake function @README_TABLE_OF_CONTENTS@
The PID_Test CMake function
PID_Test function wraps the calls to
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 )
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
These sanitizers will override the ones enabled in the project’s CMake options (e.g
SANITIZE_ADDRESS) for this test.
To lean more about this site and how it is managed you can refer to this help page.