A detailed walkthrough of refactoring a Fortran test framework to make it testable and reusable. The article demonstrates extracting test runner logic from the main program block into callable procedures, separating result collection from output generation, and introducing a test_results_t type to encapsulate test execution data. Key improvements include making run_test_suites a pure function that returns results, creating a separate handle_test_results subroutine for output, and tracking passed/failed/total test counts.
Table of contents
Breaking out of the main programMaking run_test_suites testableCollecting more test resultsSort: