Integrate pFUnit Framework for Fortran Unit Testing in obs2ioda #16
+302
−62
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TYPE: enhancement
KEYWORDS: pfunit, testing, stability
SOURCE: internal
DESCRIPTION OF CHANGES:
Problem:
obs2ioda currently lacks a unit testing framework, which makes it challenging to ensure ongoing code stability as the code evolves. This gap increases the risk of unnoticed issues, such as a recent array out-of-bounds bug that went undetected for over a year. Without unit tests, developers also lack a mechanism to validate new features or bug fixes, making it difficult to enforce good software design practices.
Solution:
This PR integrates the pFUnit framework for Fortran unit testing, providing developers with the ability to create and run unit tests for existing and new code. An example test is included to demonstrate how pFUnit could have caught a recent array out-of-bounds error. To avoid impacting the majority of obs2ioda users, pFUnit is added as an optional dependency, required only for those building and running tests. While pFUnit installation is generally straightforward, there may be minor complications in environments with multiple versions of gptl. Clear guidance on installation is provided to mitigate these risks.
TESTS CONDUCTED:
The addition of pFUnit as a testing framework strengthens code stability and enforces testable, modular code, benefiting the obs2ioda development workflow and quality assurance.