@@ -7,39 +7,44 @@ program test_optval
77
88 implicit none
99
10- call test_optval_sp
11- call test_optval_dp
12- call test_optval_qp
10+ call test_optval_rsp
11+ call test_optval_rdp
12+ call test_optval_rqp
1313
1414 call test_optval_csp
1515 call test_optval_cdp
16- call test_optval_csp
17- call test_optval_int8
18- call test_optval_int16
19- call test_optval_int32
20- call test_optval_int64
16+ call test_optval_cqp
17+
18+ call test_optval_iint8
19+ call test_optval_iint16
20+ call test_optval_iint32
21+ call test_optval_iint64
2122
2223 call test_optval_logical
2324
2425 call test_optval_character
2526
2627
27- call test_optval_sp_arr
28- call test_optval_dp_arr
29- call test_optval_qp_arr
28+ call test_optval_rsp_arr
29+ call test_optval_rdp_arr
30+ call test_optval_rqp_arr
31+
32+ call test_optval_csp_arr
33+ call test_optval_cdp_arr
34+ call test_optval_cqp_arr
3035
31- call test_optval_int8_arr
32- call test_optval_int16_arr
33- call test_optval_int32_arr
34- call test_optval_int64_arr
36+ call test_optval_iint8_arr
37+ call test_optval_iint16_arr
38+ call test_optval_iint32_arr
39+ call test_optval_iint64_arr
3540
3641contains
3742
38- subroutine test_optval_sp
39- print * , " test_optval_sp "
43+ subroutine test_optval_rsp
44+ print * , " test_optval_rsp "
4045 call assert(foo_sp(1.0_sp ) == 1.0_sp )
4146 call assert(foo_sp() == 2.0_sp )
42- end subroutine test_optval_sp
47+ end subroutine test_optval_rsp
4348
4449
4550 function foo_sp (x ) result(z)
@@ -49,11 +54,11 @@ function foo_sp(x) result(z)
4954 end function foo_sp
5055
5156
52- subroutine test_optval_dp
53- print * , " test_optval_dp "
57+ subroutine test_optval_rdp
58+ print * , " test_optval_rdp "
5459 call assert(foo_dp(1.0_dp ) == 1.0_dp )
5560 call assert(foo_dp() == 2.0_dp )
56- end subroutine test_optval_dp
61+ end subroutine test_optval_rdp
5762
5863
5964 function foo_dp (x ) result(z)
@@ -63,10 +68,24 @@ function foo_dp(x) result(z)
6368 end function foo_dp
6469
6570
71+ subroutine test_optval_rqp
72+ print * , " test_optval_rqp"
73+ call assert(foo_qp(1.0_qp ) == 1.0_qp )
74+ call assert(foo_qp() == 2.0_qp )
75+ end subroutine test_optval_rqp
76+
77+
78+ function foo_qp (x ) result(z)
79+ real (qp), intent (in ), optional :: x
80+ real (qp) :: z
81+ z = optval(x, 2.0_qp )
82+ end function foo_qp
83+
84+
6685 subroutine test_optval_csp
6786 complex (sp) :: z1
6887 print * , " test_optval_csp"
69- z1 = cmplx (1.0_sp , 2.0_sp )
88+ z1 = cmplx (1.0_sp , 2.0_sp , kind = sp )
7089 call assert(foo_csp(z1) == z1)
7190 call assert(foo_csp() == z1)
7291 end subroutine test_optval_csp
@@ -93,25 +112,26 @@ function foo_cdp(x) result(z)
93112 end function foo_cdp
94113
95114
96- subroutine test_optval_qp
97- print * , " test_optval_qp"
98- call assert(foo_qp(1.0_qp ) == 1.0_qp )
99- call assert(foo_qp() == 2.0_qp )
100- end subroutine test_optval_qp
101-
115+ subroutine test_optval_cqp
116+ complex (qp) :: z1
117+ print * , " test_optval_cqp"
118+ z1 = cmplx (1.0_qp , 2.0_qp , kind= qp)
119+ call assert(foo_cqp(z1) == z1)
120+ call assert(foo_cqp() == z1)
121+ end subroutine test_optval_cqp
102122
103- function foo_qp (x ) result(z)
104- real (qp), intent (in ), optional :: x
105- real (qp) :: z
106- z = optval(x, 2.0_qp )
107- end function foo_qp
123+ function foo_cqp (x ) result(z)
124+ complex (qp), intent (in ), optional :: x
125+ complex (qp) :: z
126+ z = optval(x, cmplx ( 1.0_qp , 2.0_qp , kind = qp) )
127+ end function foo_cqp
108128
109129
110- subroutine test_optval_int8
111- print * , " test_optval_int8 "
130+ subroutine test_optval_iint8
131+ print * , " test_optval_iint8 "
112132 call assert(foo_int8(1_int8 ) == 1_int8 )
113133 call assert(foo_int8() == 2_int8 )
114- end subroutine test_optval_int8
134+ end subroutine test_optval_iint8
115135
116136
117137 function foo_int8 (x ) result(z)
@@ -121,11 +141,11 @@ function foo_int8(x) result(z)
121141 end function foo_int8
122142
123143
124- subroutine test_optval_int16
125- print * , " test_optval_int16 "
144+ subroutine test_optval_iint16
145+ print * , " test_optval_iint16 "
126146 call assert(foo_int16(1_int16 ) == 1_int16 )
127147 call assert(foo_int16() == 2_int16 )
128- end subroutine test_optval_int16
148+ end subroutine test_optval_iint16
129149
130150
131151 function foo_int16 (x ) result(z)
@@ -135,11 +155,11 @@ function foo_int16(x) result(z)
135155 end function foo_int16
136156
137157
138- subroutine test_optval_int32
139- print * , " test_optval_int32 "
158+ subroutine test_optval_iint32
159+ print * , " test_optval_iint32 "
140160 call assert(foo_int32(1_int32 ) == 1_int32 )
141161 call assert(foo_int32() == 2_int32 )
142- end subroutine test_optval_int32
162+ end subroutine test_optval_iint32
143163
144164
145165 function foo_int32 (x ) result(z)
@@ -149,11 +169,11 @@ function foo_int32(x) result(z)
149169 end function foo_int32
150170
151171
152- subroutine test_optval_int64
172+ subroutine test_optval_iint64
153173 print * , " test_optval_int64"
154174 call assert(foo_int64(1_int64 ) == 1_int64 )
155175 call assert(foo_int64() == 2_int64 )
156- end subroutine test_optval_int64
176+ end subroutine test_optval_iint64
157177
158178
159179 function foo_int64 (x ) result(z)
@@ -191,11 +211,11 @@ function foo_character(x) result(z)
191211 end function foo_character
192212
193213
194- subroutine test_optval_sp_arr
195- print * , " test_optval_sp_arr "
214+ subroutine test_optval_rsp_arr
215+ print * , " test_optval_rsp_arr "
196216 call assert(all (foo_sp_arr([1.0_sp , - 1.0_sp ]) == [1.0_sp , - 1.0_sp ]))
197217 call assert(all (foo_sp_arr() == [2.0_sp , - 2.0_sp ]))
198- end subroutine test_optval_sp_arr
218+ end subroutine test_optval_rsp_arr
199219
200220
201221 function foo_sp_arr (x ) result(z)
@@ -205,11 +225,11 @@ function foo_sp_arr(x) result(z)
205225 end function foo_sp_arr
206226
207227
208- subroutine test_optval_dp_arr
209- print * , " test_optval_dp_arr "
228+ subroutine test_optval_rdp_arr
229+ print * , " test_optval_rdp_arr "
210230 call assert(all (foo_dp_arr([1.0_dp , - 1.0_dp ]) == [1.0_dp , - 1.0_dp ]))
211231 call assert(all (foo_dp_arr() == [2.0_dp , - 2.0_dp ]))
212- end subroutine test_optval_dp_arr
232+ end subroutine test_optval_rdp_arr
213233
214234
215235 function foo_dp_arr (x ) result(z)
@@ -219,11 +239,11 @@ function foo_dp_arr(x) result(z)
219239 end function foo_dp_arr
220240
221241
222- subroutine test_optval_qp_arr
242+ subroutine test_optval_rqp_arr
223243 print * , " test_optval_qp_arr"
224244 call assert(all (foo_qp_arr([1.0_qp , - 1.0_qp ]) == [1.0_qp , - 1.0_qp ]))
225245 call assert(all (foo_qp_arr() == [2.0_qp , - 2.0_qp ]))
226- end subroutine test_optval_qp_arr
246+ end subroutine test_optval_rqp_arr
227247
228248
229249 function foo_qp_arr (x ) result(z)
@@ -233,11 +253,62 @@ function foo_qp_arr(x) result(z)
233253 end function foo_qp_arr
234254
235255
236- subroutine test_optval_int8_arr
256+ subroutine test_optval_csp_arr
257+ complex (sp), dimension (2 ) :: z1, z2
258+ print * , " test_optval_csp_arr"
259+ z1 = cmplx (1.0_sp , 2.0_sp , kind= sp)* [1.0_sp , - 1.0_sp ]
260+ z2 = cmplx (2.0_sp , 2.0_sp , kind= sp)* [1.0_sp , - 1.0_sp ]
261+ call assert(all (foo_csp_arr(z1) == z1))
262+ call assert(all (foo_csp_arr() == z2))
263+ end subroutine test_optval_csp_arr
264+
265+
266+ function foo_csp_arr (x ) result(z)
267+ complex (sp), dimension (2 ), intent (in ), optional :: x
268+ complex (sp), dimension (2 ) :: z
269+ z = optval(x, cmplx (2.0_sp , 2.0_sp , kind= sp)* [1.0_sp , - 1.0_sp ])
270+ end function foo_csp_arr
271+
272+
273+ subroutine test_optval_cdp_arr
274+ complex (dp), dimension (2 ) :: z1, z2
275+ print * , " test_optval_cdp_arr"
276+ z1 = cmplx (1.0_dp , 2.0_dp , kind= dp)* [1.0_dp , - 1.0_dp ]
277+ z2 = cmplx (2.0_dp , 2.0_dp , kind= dp)* [1.0_dp , - 1.0_dp ]
278+ call assert(all (foo_cdp_arr(z1) == z1))
279+ call assert(all (foo_cdp_arr() == z2))
280+ end subroutine test_optval_cdp_arr
281+
282+
283+ function foo_cdp_arr (x ) result(z)
284+ complex (dp), dimension (2 ), intent (in ), optional :: x
285+ complex (dp), dimension (2 ) :: z
286+ z = optval(x, cmplx (2.0_dp , 2.0_dp , kind= dp)* [1.0_dp , - 1.0_dp ])
287+ end function foo_cdp_arr
288+
289+
290+ subroutine test_optval_cqp_arr
291+ complex (qp), dimension (2 ) :: z1, z2
292+ print * , " test_optval_cqp_arr"
293+ z1 = cmplx (1.0_qp , 2.0_qp , kind= qp)* [1.0_qp , - 1.0_qp ]
294+ z2 = cmplx (2.0_qp , 2.0_qp , kind= qp)* [1.0_qp , - 1.0_qp ]
295+ call assert(all (foo_cqp_arr(z1) == z1))
296+ call assert(all (foo_cqp_arr() == z2))
297+ end subroutine test_optval_cqp_arr
298+
299+
300+ function foo_cqp_arr (x ) result(z)
301+ complex (qp), dimension (2 ), intent (in ), optional :: x
302+ complex (qp), dimension (2 ) :: z
303+ z = optval(x, cmplx (2.0_qp , 2.0_qp , kind= qp)* [1.0_qp , - 1.0_qp ])
304+ end function foo_cqp_arr
305+
306+
307+ subroutine test_optval_iint8_arr
237308 print * , " test_optval_int8_arr"
238309 call assert(all (foo_int8_arr([1_int8 , - 1_int8 ]) == [1_int8 , - 1_int8 ]))
239310 call assert(all (foo_int8_arr() == [2_int8 , - 2_int8 ]))
240- end subroutine test_optval_int8_arr
311+ end subroutine test_optval_iint8_arr
241312
242313
243314 function foo_int8_arr (x ) result(z)
@@ -247,11 +318,11 @@ function foo_int8_arr(x) result(z)
247318 end function foo_int8_arr
248319
249320
250- subroutine test_optval_int16_arr
321+ subroutine test_optval_iint16_arr
251322 print * , " test_optval_int16_arr"
252323 call assert(all (foo_int16_arr([1_int16 , - 1_int16 ]) == [1_int16 , - 1_int16 ]))
253324 call assert(all (foo_int16_arr() == [2_int16 , - 2_int16 ]))
254- end subroutine test_optval_int16_arr
325+ end subroutine test_optval_iint16_arr
255326
256327
257328 function foo_int16_arr (x ) result(z)
@@ -261,11 +332,11 @@ function foo_int16_arr(x) result(z)
261332 end function foo_int16_arr
262333
263334
264- subroutine test_optval_int32_arr
335+ subroutine test_optval_iint32_arr
265336 print * , " test_optval_int32_arr"
266337 call assert(all (foo_int32_arr([1_int32 , - 1_int32 ]) == [1_int32 , - 1_int32 ]))
267338 call assert(all (foo_int32_arr() == [2_int32 , - 2_int32 ]))
268- end subroutine test_optval_int32_arr
339+ end subroutine test_optval_iint32_arr
269340
270341
271342 function foo_int32_arr (x ) result(z)
@@ -275,11 +346,11 @@ function foo_int32_arr(x) result(z)
275346 end function foo_int32_arr
276347
277348
278- subroutine test_optval_int64_arr
349+ subroutine test_optval_iint64_arr
279350 print * , " test_optval_int64_arr"
280351 call assert(all (foo_int64_arr([1_int64 , - 1_int64 ]) == [1_int64 , - 1_int64 ]))
281352 call assert(all (foo_int64_arr() == [2_int64 , - 2_int64 ]))
282- end subroutine test_optval_int64_arr
353+ end subroutine test_optval_iint64_arr
283354
284355
285356 function foo_int64_arr (x ) result(z)
0 commit comments