You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using subroutines instead of functions for test-drive was a deliberate choice, but I'm open to discuss and reevaluate this decision.
The optimal unit test should not require a return statement at all. Instead we should encourage aiming for smaller tests, the best in my opinion is to have a unit test like
In this scenario there is no need for a return statement at all. We get one test which tests exactly one thing.
In reality, of course, things are more complicated and one might need several check calls in one subroutine, especially if IO resources are involved, which have to be closed again. An example for such case would be test_stdlib_bitset_64. In this case one would end up with constructs like if (.not.check(error, ...)) then to continue testing, which I find unintuitive.
Maybe Brad @everythingfunctional can comment on this issue and his choice for vegetables, which is based on a somewhat similar logic to organize unit tests.
Why not simplify:
to:
Beyond that, the only other way to simplify is using macros, but I like that this is very usable without macros.
The text was updated successfully, but these errors were encountered: