pFUnit is a unit testing framework enabling JUnit-like testing of serial and MPI-parallel software written in Fortran. Limited support for OpenMP is also provided in the form of managing exceptions in a thread-safe manner.
pFUnit uses several advanced Fortran features, especially object oriented capabilities, to offer a convenient, lightweight mechanism for Fortran developers to create and run software tests that specify the desired behavior for a given piece of code.
This framework was originally created by developers from NASA and NGC TASC.
Note: Before being able to run these tests you must have pFUnit cloned and built locally. To do this follow the instructions on the pFUnit repo
The pFUnit tests will run with the rest of the cmake tests in the repo.
Compilers tested: GNU Fortran (Homebrew GCC 14.2.0_1)
| Feature | Implemented natively | Implemented manually |
|---|---|---|
| Can run individual tests | Yes (by directly calling the test executable, not ctest, we can pass -f to filter tests by name) |
N/A |
| Mocking/Stubbing | No | No |
| Data driven tests | Yes (see test_calculate_mesh_parameters.pf) | N/A |
| Coverage report | Yes or No (explanation) | Yes or No (explanation) |
| Skip tests | Partially, but there is no logging of skipped tests (add required pre-compile flag e.g. @Test(#ifdef NO_SKIP)) |
Partially (comment @Test annotation) |
| Supports testing MPI parallel code | Yes | N/A |
| Supports testing OpenMP parallel code | No | No |