Instructor companion slides
University College London
2026-11-10
“If the parts don’t work by themselves, they probably won’t work well together”
(Thomas and Hunt, 2019, The pragmatic programmer, Topic 51).
Unit tests are:
Benefits of unit tests:
Throughout this workshop you will be writing tests for the temperature conversion library provided in the exercises.
First, how can we test this library using standard Fortran?
What makes this implementation good? What makes it bad?
Good:
Bad:
Supports testing MPI parallelised code, including parameterising tests by number of MPI ranks.
A few other reasons:
Starting with the standard Fortran test we saw earlier, follow along writing tests for the temperature conversion library.
Now that we have written a test using pFUnit, let’s build it using CMake. Follow along to build your newly written pFUnit test of the temperature conversion library
What problems are there with the test we’ve just written? What happens in the case when one test scenario fails?
Starting with the pFUnit tests we have just written, follow along parameterising your tests for the temperature conversion library.
Learn how to test MPI parallelised Fortran by following the workshop notes in your own time.
Scan to view the slides

Unit testing in Fortran workshop - Back to talks