Feature: support comparison expressions that evaluate to test diagnoses#55
Merged
Conversation
This commit adds user-defined operators and corresponding unit tests. The operators that support statements of the form type(test_diagnosis_t) test_diagnosis test_diagnosis = x .approximates. y .within. tolerance for real and double-precsision operands x, y, and tolerance and test_diagnosis = i .equalsExpected. j for integer operand i and j. The right-hand side expressions above evaluate to test_diagnostics_t objects with diagnostics_string_ components formed with the assumption that x and i are actual computed values y and j corresponding expected values, respectively.
This commit adds support and corresponding unit tests for constructing a test_diagnosis_t object from real, double precision, and integer expressions of the above form.
This commit adds support and corresponding unit tests for constructing a test_diagnosis_t object from integer expressions of the forms i .lessThanOrEqualTo. j i .greaterThanOrEqualTo. j
This commit adds support and corresponding unit tests for constructing a test_diagnosis_t object from real expressions of the forms .all. ([0,3] .lessThanOrEqualTo. 1) .all. ([1,2] .greaterThanOrEqualTo. 0) where diagnostic information is printed only for specific cases that fail such as in the case of the element equal to 3 above.
This sets up the test suite to skip th test .greaterThanOrEqualTo. and .lessThanOrEqualTo. tests with gfortran because they crash.
This commit adds support and a corresponding unit test for constructing a test_diagnosis_t object from a test_diagnosis_t expression of the form (0 .lessThanOrEqualTo. 1) .and. (2 .equalsExpected. 2) where the two .and. operands are test_diagnosis_t objects, which in the above case happen to be the result expression evaluations.
bonachea
reviewed
Apr 30, 2025
Member
bonachea
left a comment
There was a problem hiding this comment.
I have not reviewed the implementation, but based on the examples in the PR description these look like great improvements!
Where is the corresponding in-repo documentation?
Is test/test_diagnosis_test_m.F90 intended to be a client-facing example that should be linked from the README?
This commit adds support and a corresponding unit test for constructing a test_diagnosis_t object from expressions that evaluate to vector test_diagnosis_t objects: .all. ((2 .equalsExpected. [2,2,2]) .and. ([0,1,2] .equalsExpected. [0,1,2])) where the two .and. operands are one-dimensional test_diagnosis_t arrays.
ktras
approved these changes
May 5, 2025
Collaborator
ktras
left a comment
There was a problem hiding this comment.
LGTM. Ready to merge after my brief commits on this branch are looked at.
Contributor
Author
|
@ktras thanks for the review! I reviewed and approved your commits and will merge now. |
rouson
added a commit
that referenced
this pull request
May 6, 2025
rouson
added a commit
that referenced
this pull request
May 8, 2025
fix(test_diagnosis): finish To Do item from PR #55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds user-defined operators and corresponding unit tests. The primary benefit of using these operators is that they eliminate some of the tedium of forming one's own
diagnostics_stringarguments when invokingtest_diagnosis_tconstructors.For
realordouble precisionvaluesx,y, andtoleranceand for integer valuesiandj, expressions of the following forms now evaluate totest_diagnosis_tobjects constructed with descriptivediagnostic_stringarguments tailored to the operators involved in the expressions:where all of the above operators are
elementaland accept conformable arguments, i.e., same-shaped array operands or array/scalar operand combinations.When the operands are arrays, the expressions evaluate to
test_diagnosis_tarrays, which could be used as theresultof a vector test function satisfying Julienne'svector_diagnosis_function_iabstract interface. Alternatively, array results can be aggregated into onetest_diagnosis_tobject using the.all.operator that this pull request also provides. For example,where expressions operated on by
.all.will result in diagnostic strings displaying only for the elements corresponding to test failures. Seetest/test_diagnosis_test_m.F90for examples of the use of the above operators.Equivalently, if pairwise aggregation suffices, then the user-defined
.and.operator in this PR can be used as follows:which is currently implemented using
.all.with a size-2 array:where
lhs = 2 .greaterThanOrEqualTo. expected_minandrhs = 1 .equalsExpected. 1.To Do
x .approximates. y .within. tolerance, switch the internal logic from using< toleranceto using<= tolerancein order to handle the (not necessarily recommended) case oftolerance==0..