Skip to content

Commit 24f2512

Browse files
committed
Cosmetic: Rename test_diagnosis variables to diag, ...
This abbreviation helps with readability, especially for the incremental test idiom (ie. `test_diagnosis = test_diagnosis .also. `). Restore line break conventions used in the incremental test idiom, which emphasizes readability of the relevant expression. Replace `.expect. .true.` with the shorter idiom in newer Julienne
1 parent f31999b commit 24f2512

11 files changed

+151
-139
lines changed

test/prif_co_broadcast_test.F90

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@ logical pure function equals(lhs, rhs)
5858
])
5959
end function
6060

61-
function broadcast_default_integer_scalar() result(test_diagnosis)
62-
type(test_diagnosis_t) test_diagnosis
61+
function broadcast_default_integer_scalar() result(diag)
62+
type(test_diagnosis_t) :: diag
6363
integer iPhone, me
6464
integer, parameter :: source_value = 7779311, junk = -99
6565

6666
call prif_this_image_no_coarray(this_image=me)
6767
iPhone = merge(source_value, junk, me==1)
6868
call prif_co_broadcast(iPhone, source_image=1)
69-
test_diagnosis = iPhone .equalsExpected. source_value
69+
diag = iPhone .equalsExpected. source_value
7070
end function
7171

72-
function broadcast_derived_type() result(test_diagnosis)
73-
type(test_diagnosis_t) test_diagnosis
72+
function broadcast_derived_type() result(diag)
73+
type(test_diagnosis_t) :: diag
7474
type(object_t) object
7575
integer me, ni
7676

@@ -79,7 +79,7 @@ function broadcast_derived_type() result(test_diagnosis)
7979
object = object_t(me, .false., "gooey", me*(1.,0.))
8080
call prif_co_broadcast(object, source_image=ni)
8181
associate(expected_object => object_t(ni, .false., "gooey", ni*(1.,0.)))
82-
test_diagnosis = .expect. (object == expected_object) // "co_broadcast derived type"
82+
diag = .expect. (object == expected_object) // "co_broadcast derived type"
8383
end associate
8484
end function
8585

test/prif_co_max_test.F90

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ function results() result(test_results)
4646
])
4747
end function
4848

49-
function check_default_integer() result(test_diagnosis)
50-
type(test_diagnosis_t) :: test_diagnosis
49+
function check_default_integer() result(diag)
50+
type(test_diagnosis_t) :: diag
5151

5252
integer, parameter :: values(*,*) = reshape([1, -19, 5, 13, 11, 7, 17, 3], [2, 4])
5353
integer :: me, ni, i
@@ -60,11 +60,11 @@ function check_default_integer() result(test_diagnosis)
6060
call prif_co_max(my_val)
6161

6262
expected = maxval(reshape([(values(:, mod(i-1,size(values,2))+1), i = 1, ni)], [size(values,1),ni]), dim=2)
63-
test_diagnosis = .all. (int(my_val) .equalsExpected. int(expected))
63+
diag = .all. (int(my_val) .equalsExpected. int(expected))
6464
end function
6565

66-
function check_8_bit_integer() result(test_diagnosis)
67-
type(test_diagnosis_t) :: test_diagnosis
66+
function check_8_bit_integer() result(diag)
67+
type(test_diagnosis_t) :: diag
6868

6969
integer(c_int8_t), parameter :: values(*,*) = reshape(int([1, -19, 5, 13, 11, 7, 17, 3],c_int8_t), [2, 4])
7070
integer :: me, ni, i
@@ -77,11 +77,11 @@ function check_8_bit_integer() result(test_diagnosis)
7777
call prif_co_max(my_val)
7878

7979
expected = maxval(reshape([(values(:, mod(i-1,size(values,2))+1), i = 1, ni)], [size(values,1),ni]), dim=2)
80-
test_diagnosis = .all. (int(my_val) .equalsExpected. int(expected))
80+
diag = .all. (int(my_val) .equalsExpected. int(expected))
8181
end function
8282

83-
function check_16_bit_integer() result(test_diagnosis)
84-
type(test_diagnosis_t) :: test_diagnosis
83+
function check_16_bit_integer() result(diag)
84+
type(test_diagnosis_t) :: diag
8585

8686
integer(c_int16_t), parameter :: values(*,*) = reshape(int([1, -19, 5, 13, 11, 7, 17, 3],c_int16_t), [2, 4])
8787
integer :: me, ni, i
@@ -94,11 +94,11 @@ function check_16_bit_integer() result(test_diagnosis)
9494
call prif_co_max(my_val)
9595

9696
expected = maxval(reshape([(values(:, mod(i-1,size(values,2))+1), i = 1, ni)], [size(values,1),ni]), dim=2)
97-
test_diagnosis = .all. (int(my_val) .equalsExpected. int(expected))
97+
diag = .all. (int(my_val) .equalsExpected. int(expected))
9898
end function
9999

100-
function check_32_bit_integer() result(test_diagnosis)
101-
type(test_diagnosis_t) :: test_diagnosis
100+
function check_32_bit_integer() result(diag)
101+
type(test_diagnosis_t) :: diag
102102

103103
integer(c_int32_t), parameter :: values(*) = [1, -19, 5, 13, 11, 7, 17, 3]
104104
integer :: me, ni, i
@@ -111,11 +111,11 @@ function check_32_bit_integer() result(test_diagnosis)
111111
call prif_co_max(my_val)
112112

113113
expected = maxval([(values(mod(i-1,size(values))+1), i = 1, ni)])
114-
test_diagnosis = my_val .equalsExpected. expected
114+
diag = my_val .equalsExpected. expected
115115
end function
116116

117-
function check_64_bit_integer() result(test_diagnosis)
118-
type(test_diagnosis_t) :: test_diagnosis
117+
function check_64_bit_integer() result(diag)
118+
type(test_diagnosis_t) :: diag
119119

120120
integer(c_int64_t), parameter :: values(*,*) = reshape([1, -19, 5, 13, 11, 7, 17, 3], [2, 4])
121121
integer :: me, ni, i
@@ -128,11 +128,11 @@ function check_64_bit_integer() result(test_diagnosis)
128128
call prif_co_max(my_val)
129129

130130
expected = maxval(reshape([(values(:, mod(i-1,size(values,2))+1), i = 1, ni)], [size(values,1),ni]), dim=2)
131-
test_diagnosis = .all. (int(my_val) .equalsExpected. int(expected))
131+
diag = .all. (int(my_val) .equalsExpected. int(expected))
132132
end function
133133

134-
function check_32_bit_real() result(test_diagnosis)
135-
type(test_diagnosis_t) :: test_diagnosis
134+
function check_32_bit_real() result(diag)
135+
type(test_diagnosis_t) :: diag
136136

137137
real(c_float), parameter :: values(*,*,*) = reshape([1, 19, 5, 13, 11, 7, 17, 3], [2,2,2])
138138
real(c_float), parameter :: tolerance = 0_c_float
@@ -146,11 +146,11 @@ function check_32_bit_real() result(test_diagnosis)
146146
call prif_co_max(my_val)
147147

148148
expected = maxval(reshape([(values(:,:,mod(i-1,size(values,3))+1), i = 1, ni)], [size(values,1), size(values,2), ni]), dim=3)
149-
test_diagnosis = .all. (my_val .approximates. expected .within. tolerance)
149+
diag = .all. (my_val .approximates. expected .within. tolerance)
150150
end function
151151

152-
function check_64_bit_real() result(test_diagnosis)
153-
type(test_diagnosis_t) :: test_diagnosis
152+
function check_64_bit_real() result(diag)
153+
type(test_diagnosis_t) :: diag
154154

155155
real(c_double), parameter :: values(*,*) = reshape([1, 19, 5, 13, 11, 7, 17, 3], [2, 4])
156156
real(c_double), parameter :: tolerance = 0_c_double
@@ -164,11 +164,11 @@ function check_64_bit_real() result(test_diagnosis)
164164
call prif_co_max(my_val)
165165

166166
expected = maxval(reshape([(values(:, mod(i-1,size(values,2))+1), i = 1, ni)], [size(values,1),ni]), dim=2)
167-
test_diagnosis = .all. (my_val .approximates. expected .within. tolerance)
167+
diag = .all. (my_val .approximates. expected .within. tolerance)
168168
end function
169169

170-
function check_character() result(test_diagnosis)
171-
type(test_diagnosis_t) test_diagnosis
170+
function check_character() result(diag)
171+
type(test_diagnosis_t) :: diag
172172
character(len=*), parameter :: values(*) = &
173173
[ "To be ","or not " &
174174
, "to ","be. " &
@@ -185,7 +185,7 @@ function check_character() result(test_diagnosis)
185185

186186
! issue #205: workaround flang optimizer bug with a temp
187187
associate(tmp => [(values(mod(i-1,size(values))+1), i = 1, ni)])
188-
test_diagnosis = my_val .equalsExpected. maxval(tmp)
188+
diag = my_val .equalsExpected. maxval(tmp)
189189
end associate
190190
end function
191191

test/prif_co_min_test.F90

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ function results() result(test_results)
4444
])
4545
end function
4646

47-
function check_default_integer() result(test_diagnosis)
48-
type(test_diagnosis_t) test_diagnosis
47+
function check_default_integer() result(diag)
48+
type(test_diagnosis_t) :: diag
4949

5050
integer, parameter :: values(*,*) = reshape([1, -19, 5, 13, 11, 7, 17, 3], [2, 4])
5151
integer, dimension(size(values,1)) :: my_val, expected
@@ -58,11 +58,11 @@ function check_default_integer() result(test_diagnosis)
5858
call prif_co_min(my_val)
5959

6060
expected = minval(reshape([(values(:, mod(i-1,size(values,2))+1), i = 1, ni)], [size(values,1),ni]), dim=2)
61-
test_diagnosis = .all. (int(my_val) .equalsExpected. int(expected))
61+
diag = .all. (int(my_val) .equalsExpected. int(expected))
6262
end function
6363

64-
function check_8_bit_integer() result(test_diagnosis)
65-
type(test_diagnosis_t) test_diagnosis
64+
function check_8_bit_integer() result(diag)
65+
type(test_diagnosis_t) :: diag
6666

6767
integer(c_int8_t), parameter :: values(*,*) = reshape(int([1, -19, 5, 13, 11, 7, 17, 3],c_int8_t), [2, 4])
6868
integer :: me, ni, i
@@ -75,11 +75,11 @@ function check_8_bit_integer() result(test_diagnosis)
7575
call prif_co_min(my_val)
7676

7777
expected = minval(reshape([(values(:, mod(i-1,size(values,2))+1), i = 1, ni)], [size(values,1),ni]), dim=2)
78-
test_diagnosis = .all. (int(my_val) .equalsExpected. int(expected))
78+
diag = .all. (int(my_val) .equalsExpected. int(expected))
7979
end function
8080

81-
function check_16_bit_integer() result(test_diagnosis)
82-
type(test_diagnosis_t) test_diagnosis
81+
function check_16_bit_integer() result(diag)
82+
type(test_diagnosis_t) :: diag
8383

8484
integer(c_int16_t), parameter :: values(*,*) = reshape(int([1, -19, 5, 13, 11, 7, 17, 3],c_int16_t), [2, 4])
8585
integer :: me, ni, i
@@ -92,11 +92,11 @@ function check_16_bit_integer() result(test_diagnosis)
9292
call prif_co_min(my_val)
9393

9494
expected = minval(reshape([(values(:, mod(i-1,size(values,2))+1), i = 1, ni)], [size(values,1),ni]), dim=2)
95-
test_diagnosis = .all. (int(my_val) .equalsExpected. int(expected))
95+
diag = .all. (int(my_val) .equalsExpected. int(expected))
9696
end function
9797

98-
function check_32_bit_integer() result(test_diagnosis)
99-
type(test_diagnosis_t) test_diagnosis
98+
function check_32_bit_integer() result(diag)
99+
type(test_diagnosis_t) :: diag
100100

101101
integer(c_int32_t), parameter :: values(*) = [1, -19, 5, 13, 11, 7, 17, 3]
102102
integer :: me, ni, i
@@ -109,11 +109,11 @@ function check_32_bit_integer() result(test_diagnosis)
109109
call prif_co_min(my_val)
110110

111111
expected = minval([(values(mod(i-1,size(values))+1), i = 1, ni)])
112-
test_diagnosis = int(my_val) .equalsExpected. int(expected)
112+
diag = int(my_val) .equalsExpected. int(expected)
113113
end function
114114

115-
function check_64_bit_integer() result(test_diagnosis)
116-
type(test_diagnosis_t) test_diagnosis
115+
function check_64_bit_integer() result(diag)
116+
type(test_diagnosis_t) :: diag
117117

118118
integer(c_int64_t), parameter :: values(*,*) = reshape([1, -19, 5, 13, 11, 7, 17, 3], [2, 4])
119119
integer :: me, ni, i
@@ -126,11 +126,11 @@ function check_64_bit_integer() result(test_diagnosis)
126126
call prif_co_min(my_val)
127127

128128
expected = minval(reshape([(values(:, mod(i-1,size(values,2))+1), i = 1, ni)], [size(values,1),ni]), dim=2)
129-
test_diagnosis = .all. (int(my_val) .equalsExpected. int(expected))
129+
diag = .all. (int(my_val) .equalsExpected. int(expected))
130130
end function
131131

132-
function check_32_bit_real() result(test_diagnosis)
133-
type(test_diagnosis_t) test_diagnosis
132+
function check_32_bit_real() result(diag)
133+
type(test_diagnosis_t) :: diag
134134

135135
real(c_float), parameter :: values(*,*,*) = reshape([1, 19, 5, 13, 11, 7, 17, 3], [2,2,2])
136136
real(c_double), parameter :: tolerance = 0_c_double
@@ -144,11 +144,11 @@ function check_32_bit_real() result(test_diagnosis)
144144
call prif_co_min(my_val)
145145

146146
expected = minval(reshape([(values(:,:,mod(i-1,size(values,3))+1), i = 1, ni)], [size(values,1), size(values,2), ni]), dim=3)
147-
test_diagnosis = .all. (real(expected,kind=c_double) .approximates. real(my_val,kind=c_double) .within. tolerance)
147+
diag = .all. (real(expected,kind=c_double) .approximates. real(my_val,kind=c_double) .within. tolerance)
148148
end function
149149

150-
function check_64_bit_real() result(test_diagnosis)
151-
type(test_diagnosis_t) test_diagnosis
150+
function check_64_bit_real() result(diag)
151+
type(test_diagnosis_t) :: diag
152152

153153
real(c_double), parameter :: values(*,*) = reshape([1, 19, 5, 13, 11, 7, 17, 3], [2, 4])
154154
real(c_double), parameter :: tolerance = 0_c_double
@@ -162,11 +162,11 @@ function check_64_bit_real() result(test_diagnosis)
162162
call prif_co_min(my_val)
163163

164164
expected = minval(reshape([(values(:, mod(i-1,size(values,2))+1), i = 1, ni)], [size(values,1),ni]), dim=2)
165-
test_diagnosis = .all. (my_val .approximates. expected .within. tolerance)
165+
diag = .all. (my_val .approximates. expected .within. tolerance)
166166
end function
167167

168-
function check_character() result(test_diagnosis)
169-
type(test_diagnosis_t) test_diagnosis
168+
function check_character() result(diag)
169+
type(test_diagnosis_t) :: diag
170170
character(len=*), parameter :: values(*) = &
171171
[ "To be ","or not " &
172172
, "to ","be. " &
@@ -183,7 +183,7 @@ function check_character() result(test_diagnosis)
183183

184184
! issue #205: workaround flang optimizer bug with a temp
185185
associate(tmp => [(values(mod(i-1,size(values))+1), i = 1, ni)])
186-
test_diagnosis = .all. (my_val .equalsExpected. minval(tmp))
186+
diag = .all. (my_val .equalsExpected. minval(tmp))
187187
end associate
188188
end function
189189

test/prif_co_reduce_test.F90

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,26 @@ function results() result(test_results)
6161
])
6262
end function
6363

64-
function check_logical() result(test_diagnosis)
65-
type(test_diagnosis_t) test_diagnosis
64+
function check_logical() result(diag)
65+
type(test_diagnosis_t) :: diag
6666
logical :: val
6767
integer :: me
6868
procedure(prif_operation_wrapper_interface), pointer :: op
69+
diag = .true.
6970
op => and_wrapper
7071

7172
val = .true.
7273
call prif_co_reduce(val, op, c_null_ptr)
73-
test_diagnosis = .expect. val
74+
diag = diag .also. &
75+
.expect. val
7476

7577
call prif_this_image_no_coarray(this_image=me)
7678
if (me == 1) then
7779
val = .false.
7880
end if
7981
call prif_co_reduce(val, op, c_null_ptr)
80-
test_diagnosis = test_diagnosis .also. (.expect. (.not. val))
82+
diag = diag .also. &
83+
.expect. (.not. val)
8184
end function
8285

8386
subroutine and_wrapper(arg1, arg2_and_out, count, cdata) bind(C)
@@ -96,8 +99,8 @@ subroutine and_wrapper(arg1, arg2_and_out, count, cdata) bind(C)
9699
end do
97100
end subroutine
98101

99-
function check_derived_type_reduction() result(test_diagnosis)
100-
type(test_diagnosis_t) test_diagnosis
102+
function check_derived_type_reduction() result(diag)
103+
type(test_diagnosis_t) :: diag
101104
type(pair), parameter :: values(*,*) = reshape( &
102105
[ pair(1, 53.), pair(3, 47.) &
103106
, pair(5, 43.), pair(7, 41.) &
@@ -134,7 +137,7 @@ function check_derived_type_reduction() result(test_diagnosis)
134137
#else
135138
expected = reduce(tmp, add_pair, dim=2)
136139
#endif
137-
test_diagnosis = .all. (my_val%fst .equalsExpected. expected%fst) &
140+
diag = .all. (my_val%fst .equalsExpected. expected%fst) &
138141
.also. (.all. ( real(my_val%snd, kind=kind(0.d0)) .approximates. real(expected%snd, kind=kind(0.d0)) .within. tolerance))
139142
end function
140143

@@ -170,8 +173,8 @@ subroutine pair_adder(arg1, arg2_and_out, count, cdata) bind(C)
170173
! Gfortran 14.2 also lacks the type support for this test:
171174
! Error: Derived type 'pdtarray' at (1) is being used before it is defined
172175

173-
function check_type_parameter_reduction() result(test_diagnosis)
174-
type(test_diagnosis_t) test_diagnosis
176+
function check_type_parameter_reduction() result(diag)
177+
type(test_diagnosis_t) :: diag
175178
type(array), parameter :: values(*,*) = reshape( &
176179
[ array(elements=[1, 53]), array(elements=[3, 47]) &
177180
, array(elements=[5, 43]), array(elements=[7, 41]) &
@@ -194,7 +197,7 @@ function check_type_parameter_reduction() result(test_diagnosis)
194197
call prif_co_reduce(my_val, op, c_loc(context))
195198

196199
expected = reduce(reshape([(values(:, mod(i-1,size(values,2))+1), i = 1, ni)], [size(values,1),ni]), add_array, dim=2)
197-
test_diagnosis = .all. (my_val%elements .equalsExpected. expected%elements)
200+
diag = .all. (my_val%elements .equalsExpected. expected%elements)
198201
end function
199202

200203
pure function add_array(lhs, rhs) result(total)

0 commit comments

Comments
 (0)