Automated test-suite scaffolding, simpler tests, logical assertions
New Features
Simple logical assertions 🧪
Julienne's new logical assertions. are useful when a literal copy of the asserted condition suffices for diagnostic information when an assertion fails. Examples include call_julienne_assert(allocated(a)) and call julienne_assert(allocated(a)) for conditionally and unconditionally executed assertions, respectively.
Test simplification 💃
Julienne now hides the test-filtering logic so a user's definition of the required results function simply requires declaring an instance of a test_t child type, invoking the instance's inherited run function with a test_description_t array argument, and assigning the run result to the results function result:
function results() result(test_results)
type(specimen_test_t) specimen_test
type(test_result_t), allocatable :: test_results(:)
test_results = specimen_test%run([test_description_t("checking something", diagnosis_function)])
end functionwhere specimen_test_t extends test_t and diagnosis_function performs the test and conforms to Julienne's diagnosis_function_i abstract interface.
Scaffolding automation 🤖
Given an existing demo/test subdirectory and a JSON file containing a "test subjects" key with an array value specifying test names, a command like the following creates the test suite for Julienne's demonstration project:
fpm run scaffold --compiler flang-new --flag "-O3 -g" -- --json-file demo/test-suite.json --suite-path demo/test which instructs scaffold to incorporate each test name into a corresponding test_t child type (e.g., specimen_test_t type), create simple tests in a like-named module (e.g., specimen_test_m module), and write a main program in demo/driver.f90. Running the main program with the following command executes the tests:
cd demo
fpm test --compiler flang-new --flag "-O3"
The scaffold program currently builds only with the LLVM (flang-new) compiler, but the generated demonstration test suite (or an analogous handwritten test suite) builds with any of the supported compilers: LLVM (flang-new), GCC (gfortran), Intel (ifx), and NAG (nagfor). Minor fixes are under way to get the scaffold program itself working with the latter three compilers.
Breaking change
The previously deprecated vector_test_description_t type and vector_diagnosis_function_i abstract interface have been removed in order to simplify automatic driver creation.
Pull Request Log
- 🧹 Assertion chores, fixes, documentation and new test by @rouson in #84
- 🧶 Fix(julienne_assert): define string only for fails by @rouson in #85
- ☕ Centralize the test filtering logic to test_description_m by @rouson in #91
- 🚚 Automatically generate demo test suite from JSON file by @rouson in #92
- 👩⚕️ Doc(test_result_t): clarify role by @rouson in #94
- 🍬 Feature: logical_assert thinner wrapper around Assert's assert_always by @rouson in #95
- 🩹 Workaround gfortran 13 issue by @rouson in #96
Full Changelog: 2.4.3...3.0.0