Skip to content

Commit fe7a54a

Browse files
committed
feat(test_diagnosis): aggregates vector diagnoses
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.
1 parent 971eb74 commit fe7a54a

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

test/test_diagnosis_test_m.F90

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ function results() result(test_results)
5959
,test_description_t("contruction from a integer expression of the form 'i .greaterThan. j", check_greater_than_integer) &
6060
,test_description_t("contruction from a integer expression of the form '[i,j] .lessThanOrEqualTo. k", check_less_than_or_equal_to_integer) &
6161
,test_description_t("contruction from a integer expression of the form '[i,j] .greaterThanOrEqualTo. k", check_greater_than_or_equal_to_integer) &
62-
,test_description_t("contruction from a test_diagnostics_t expression of the form 't .and. u'", check_and_operator) &
62+
,test_description_t("contruction from a scalar test_diagnostics_t expression of the form 't .and. u'", check_and_with_scalar_operands) &
63+
,test_description_t("contruction from vector test_diagnostics_t expressions with operands like 'i .equalsExpected. [j,k]'", check_and_with_vector_operands) &
6364
] )
6465
#else
6566
! Work around missing Fortran 2008 feature: associating a procedure actual argument with a procedure pointer dummy argument:
@@ -71,7 +72,8 @@ function results() result(test_results)
7172
,check_less_than_double_ptr , check_greater_than_double_ptr &
7273
,check_less_than_integer_ptr , check_greater_than_integer_ptr &
7374
,check_less_than_or_equal_to_integer_ptr, check_greater_than_or_equal_to_integer_ptr &
74-
,check_and_operator_ptr
75+
,check_and_with_scalar_operands_ptr &
76+
,check_and_with_vector_operands_ptr
7577

7678
check_approximates_real_ptr => check_approximates_real
7779
check_approximates_double_ptr => check_approximates_double
@@ -84,7 +86,8 @@ function results() result(test_results)
8486
check_greater_than_double_ptr => check_greater_than_double
8587
check_greater_than_integer_ptr => check_greater_than_integer
8688
check_greater_than_or_equal_to_integer_ptr => check_greater_than_or_equal_to_integer
87-
check_and_operator_ptr => check_and_operator
89+
check_and_with_scalar_operands_ptr => check_and_with_scalar_operands
90+
check_and_with_vector_operands_ptr => check_and_with_vector_operands
8891

8992
descriptions = [ &
9093
test_description_t("contruction from a real expression of the form `x .approximates. y .within. tolerance`" , check_approximates_real_ptr) &
@@ -98,7 +101,9 @@ function results() result(test_results)
98101
,test_description_t("contruction from a double precision expression of the form 'x .greaterThan. y" , check_greater_than_double_ptr) &
99102
,test_description_t("contruction from a integer expression of the form 'i .greaterThan. j" , check_greater_than_integer_ptr) &
100103
,test_description_t("contruction from a integer expression of the form 'i .greaterThanOrEqualTo. j") & ! skip check_greater_than_or_equal_to_integer_ptr
101-
,test_description_t("contruction from a test_diagnostics_t expression of the form 't .and. u'" ) & ! skip check_and_operator_ptr
104+
,test_description_t("contruction from a scalar test_diagnostics_t expression with operands like 'i .equalsExpected. j'" ) & ! skip check_and_with_scalar_operands_ptr
105+
,test_description_t("contruction from test_diagnostics_t vector expressions with operands like 'i .equalsExpected. [j,k]'") & ! skip check_and_with_vector_operands_ptr
106+
check_and_with_vector_operands
102107
]
103108
#endif
104109

@@ -192,10 +197,15 @@ function check_greater_than_or_equal_to_integer() result(test_diagnosis)
192197
test_diagnosis = .all. ([1,2] .greaterThanOrEqualTo. expected_min)
193198
end function
194199

195-
function check_and_operator() result(test_diagnosis)
200+
function check_and_with_scalar_operands() result(test_diagnosis)
196201
type(test_diagnosis_t) test_diagnosis
197202
integer, parameter :: expected_min = 1
198203
test_diagnosis = (2 .greaterThanOrEqualTo. expected_min) .and. (1 .equalsExpected. 1)
199204
end function
200205

206+
function check_and_with_vector_operands() result(test_diagnoses)
207+
type(test_diagnosis_t) test_diagnoses
208+
test_diagnoses = .all. ((2 .equalsExpected. [2,2,2]) .and. ([0,1,2] .equalsExpected. [0,1,2]))
209+
end function
210+
201211
end module test_diagnosis_test_m

0 commit comments

Comments
 (0)