Skip to content

Unit tests enabled with catch2

tim-band requested to merge UCL-ARC/collaborations/sherpa:catch2-tests into master

Description

Hi Sherpa team! We are thinking of adding some unit tests using the Catch2 framework; this is issue #489 (closed). This MR adds the appropriate pieces to the build and run tests and includes one example unit test (which will be built upon with later MRs). I don't know why I needed to be more explicit in declaring inter-module dependencies in some of the CMakeLists.txt files to get it to build, but these seem like reasonable additions.

Test Plan

This fits into the standard ctest execution.

Example Result

$ ctest --test-dir build
Internal ctest changing into directory: /home/ucfbtpb/source/hep-swift/sherpa/build
Test project /home/ucfbtpb/source/hep-swift/sherpa/build
    Start 1: Spinor construction
1/5 Test #1: Spinor construction ..............   Passed    0.01 sec
    Start 2: Maintest-Amegic-LO_Zpart1
2/5 Test #2: Maintest-Amegic-LO_Zpart1 ........   Passed   36.21 sec
    Start 3: Maintest-Amegic-LO_Zpart2
3/5 Test #3: Maintest-Amegic-LO_Zpart2 ........   Passed    4.77 sec
    Start 4: Maintest-Amegic-LO_Zpart3
4/5 Test #4: Maintest-Amegic-LO_Zpart3 ........   Passed   35.18 sec
    Start 5: Maintest-LO_Zpart1
5/5 Test #5: Maintest-LO_Zpart1 ...............   Passed   20.88 sec

100% tests passed, 0 tests failed out of 5

Additional Checklist Items

  • I have updated documentation as needed
  • I considered if this should be cherry-picked/ported somewhere else (rel-2-x or master), and if yes, opened a corresponding issue or MR

Merge request reports