NCAR / obs2ioda

Converter developed by @jamiebresch to transform conventional and remote sensing observations in different formats to the IODA format needed in JEDI
4 stars 4 forks source link

Integrate pFUnit Framework for Fortran Unit Testing in obs2ioda #16

Closed amstokely closed 5 days ago

amstokely commented 1 week ago

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.