-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use assertions rather than print statements in tests #166
base: main
Are you sure you want to change the base?
Conversation
05dca97
to
4d6fe1a
Compare
One discussion to have about these changes is whether we're happy that the examples are becoming more verbose. The versions without assertions will still be used in the docs but (e.g.) |
src/utils.f90
Outdated
test_pass = (abs(got - expect) <= rtol_value * abs(expect)) | ||
|
||
if (print_result_value) then | ||
write(message,'("relative tolerance = ", E11.4)') rtol_value | ||
call test_print(test_name, message, test_pass) | ||
end if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We refactored the relative error check to avoid divide-by-zero type errors. However, a downside is that we can no longer print the relative error values upon error without further computation and special case handling that we wanted to avoid. Instead, I just print the relative tolerance used.
Perhaps we could just print the two values being compared?
Huh! The CI has spontaneously hit a shape error again As suggested by @TomMelt, we should use valgrind to see if there's a memory leak. |
Closes #142.
As part of this PR, we introduce a module for test utils, e.g., printing test results and making assertions.