Skip to content

Commit cb00c8a

Browse files
committed
update unit test
1 parent f1b165c commit cb00c8a

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

src/tests/jf_test_46.F90

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ subroutine test_46(error_cnt)
3131
integer(IK) :: ival
3232
real(RK) :: rval
3333
real :: r32val
34+
real,dimension(:),allocatable :: r32vec
3435
logical(LK) :: lval
3536
character(kind=CK,len=:),allocatable :: cval
3637
character(kind=CK,len=1),dimension(:),allocatable :: cvec
3738
character(kind=CK,len=:),dimension(:),allocatable :: cvec2
3839
integer(IK),dimension(:),allocatable :: ilen
3940

40-
character(kind=CK,len=1),dimension(1) :: cvec_default = [CK_'1']
41-
integer(IK),dimension(1) :: ilen_default = [1]
41+
character(kind=CK,len=1),dimension(1),parameter :: cvec_default = [CK_'1']
42+
integer(IK),dimension(1),parameter :: ilen_default = [1]
43+
real,dimension(1),parameter :: r32vec_default = [99.0]
4244

4345
write(error_unit,'(A)') ''
4446
write(error_unit,'(A)') '================================='
@@ -65,7 +67,13 @@ subroutine test_46(error_cnt)
6567

6668
call json%get(p, CK_'not_there', r32val, found, default=99.0) ! real32
6769
if (json%failed() .or. found .or. r32val-99.0>0.0) then
68-
write(error_unit,'(A)') 'Error using json_get_real_by_path default'
70+
write(error_unit,'(A)') 'Error using json_get_real32_by_path default'
71+
error_cnt = error_cnt + 1
72+
end if
73+
74+
call json%get(p, CK_'not_there', r32vec, found, default=r32vec_default) ! real32 vec
75+
if (json%failed() .or. found .or. any(r32vec-r32vec_default>.0)) then
76+
write(error_unit,'(A)') 'Error using json_get_real32_by_path default'
6977
error_cnt = error_cnt + 1
7078
end if
7179

@@ -88,17 +96,17 @@ subroutine test_46(error_cnt)
8896
end if
8997

9098
call json%get(p, CK_'not_there', cvec, found, default=cvec_default)
91-
if (json%failed() .or. found .or. all(cvec /= cvec_default)) then
99+
if (json%failed() .or. found .or. any(cvec /= cvec_default)) then
92100
write(error_unit,'(A)') 'Error using json_get_string_vec_by_path default'
93101
error_cnt = error_cnt + 1
94102
end if
95103
call json%get(p, CK_'not_there', cvec2, ilen, found, default=cvec_default)
96-
if (json%failed() .or. found .or. all(cvec2 /= cvec_default) .or. all(ilen/=1_IK)) then
104+
if (json%failed() .or. found .or. any(cvec2 /= cvec_default) .or. any(ilen/=1_IK)) then
97105
write(error_unit,'(A)') 'Error using json_get_alloc_string_vec_by_path default'
98106
error_cnt = error_cnt + 1
99107
end if
100108
call json%get(p, CK_'not_there', cvec2, ilen, found, default=cvec_default, default_ilen=ilen_default)
101-
if (json%failed() .or. found .or. all(cvec2 /= cvec_default) .or. all(ilen/=1_IK)) then
109+
if (json%failed() .or. found .or. any(cvec2 /= cvec_default) .or. any(ilen/=1_IK)) then
102110
write(error_unit,'(A)') 'Error using json_get_alloc_string_vec_by_path default'
103111
error_cnt = error_cnt + 1
104112
end if
@@ -129,17 +137,17 @@ subroutine test_46(error_cnt)
129137
end if
130138

131139
call json%get(p, 'not_there', cvec, found, default=[CK_'1'])
132-
if (json%failed() .or. found .or. all(cvec /= [CK_'1'])) then
140+
if (json%failed() .or. found .or. any(cvec /= [CK_'1'])) then
133141
write(error_unit,'(A)') 'Error using json_get_string_vec_by_path default'
134142
error_cnt = error_cnt + 1
135143
end if
136144
call json%get(p, 'not_there', cvec2, ilen, found, default=cvec_default)
137-
if (json%failed() .or. found .or. all(cvec2 /= cvec_default) .or. all(ilen/=1_IK)) then
145+
if (json%failed() .or. found .or. any(cvec2 /= cvec_default) .or. any(ilen/=1_IK)) then
138146
write(error_unit,'(A)') 'Error using json_get_alloc_string_vec_by_path default'
139147
error_cnt = error_cnt + 1
140148
end if
141149
call json%get(p, 'not_there', cvec2, ilen, found, default=cvec_default, default_ilen=ilen_default)
142-
if (json%failed() .or. found .or. all(cvec2 /= cvec_default) .or. all(ilen/=1_IK)) then
150+
if (json%failed() .or. found .or. any(cvec2 /= cvec_default) .or. any(ilen/=1_IK)) then
143151
write(error_unit,'(A)') 'Error using json_get_alloc_string_vec_by_path default'
144152
error_cnt = error_cnt + 1
145153
end if
@@ -186,17 +194,17 @@ subroutine test_46(error_cnt)
186194
end if
187195

188196
call json_f%get(CK_'not_there', cvec, found, default=cvec_default)
189-
if (json%failed() .or. found .or. all(cvec /= cvec_default)) then
197+
if (json%failed() .or. found .or. any(cvec /= cvec_default)) then
190198
write(error_unit,'(A)') 'Error using json_get_string_vec_by_path default'
191199
error_cnt = error_cnt + 1
192200
end if
193201
call json_f%get(CK_'not_there', cvec2, ilen, found, default=cvec_default)
194-
if (json%failed() .or. found .or. all(cvec2 /= cvec_default) .or. all(ilen/=1_IK)) then
202+
if (json%failed() .or. found .or. any(cvec2 /= cvec_default) .or. any(ilen/=1_IK)) then
195203
write(error_unit,'(A)') 'Error using json_get_alloc_string_vec_by_path default'
196204
error_cnt = error_cnt + 1
197205
end if
198206
call json_f%get(CK_'not_there', cvec2, ilen, found, default=cvec_default, default_ilen=ilen_default)
199-
if (json%failed() .or. found .or. all(cvec2 /= cvec_default) .or. all(ilen/=1_IK)) then
207+
if (json%failed() .or. found .or. any(cvec2 /= cvec_default) .or. any(ilen/=1_IK)) then
200208
write(error_unit,'(A)') 'Error using json_get_alloc_string_vec_by_path default'
201209
error_cnt = error_cnt + 1
202210
end if
@@ -227,17 +235,17 @@ subroutine test_46(error_cnt)
227235
end if
228236

229237
call json_f%get('not_there', cvec, found, default=cvec_default)
230-
if (json%failed() .or. found .or. all(cvec /= cvec_default)) then
238+
if (json%failed() .or. found .or. any(cvec /= cvec_default)) then
231239
write(error_unit,'(A)') 'Error using json_get_string_vec_by_path default'
232240
error_cnt = error_cnt + 1
233241
end if
234242
call json_f%get('not_there', cvec2, ilen, found, default=cvec_default)
235-
if (json%failed() .or. found .or. all(cvec2 /= cvec_default) .or. all(ilen/=1_IK)) then
243+
if (json%failed() .or. found .or. any(cvec2 /= cvec_default) .or. any(ilen/=1_IK)) then
236244
write(error_unit,'(A)') 'Error using json_get_alloc_string_vec_by_path default'
237245
error_cnt = error_cnt + 1
238246
end if
239247
call json_f%get('not_there', cvec2, ilen, found, default=cvec_default, default_ilen=ilen_default)
240-
if (json%failed() .or. found .or. all(cvec2 /= cvec_default) .or. all(ilen/=1_IK)) then
248+
if (json%failed() .or. found .or. any(cvec2 /= cvec_default) .or. any(ilen/=1_IK)) then
241249
write(error_unit,'(A)') 'Error using json_get_alloc_string_vec_by_path default'
242250
error_cnt = error_cnt + 1
243251
end if

0 commit comments

Comments
 (0)