Skip to content

Commit 0c0c4a1

Browse files
committed
Maybe it needs allocation
1 parent 36b7ad7 commit 0c0c4a1

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

test/io/test_np.f90

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,15 +1161,8 @@ subroutine npz_save_two_arrays(error)
11611161
call add_array(arrays, input_array_1, stat, name=array_name_1)
11621162
call check(error, stat, "Error adding array 1 to the list of arrays.")
11631163
if (allocated(error)) return
1164-
1165-
input_array_2 = (/(1.0_dp, 2.0_dp), (3.0_dp, 4.0_dp), (5.0_dp, 6.0_dp)/)
1166-
call add_array(arrays, input_array_2, stat, name=array_name_2)
1167-
call check(error, stat, "Error adding array 2 to the list of arrays.")
1168-
if (allocated(error)) return
1169-
call check(error, size(arrays) == 2, "Wrong array size.")
1170-
if (allocated(error)) return
11711164

1172-
print *, 'in test'
1165+
print *, 'first array'
11731166
do j = 1, size(arrays)
11741167
print *, arrays(j)%array%name
11751168
select type (typed_array => arrays(1)%array)
@@ -1181,6 +1174,25 @@ subroutine npz_save_two_arrays(error)
11811174
end select
11821175
end do
11831176

1177+
allocate(input_array_2, source=[(1.0_dp, 2.0_dp), (3.0_dp, 4.0_dp), (5.0_dp, 6.0_dp)])
1178+
call add_array(arrays, input_array_2, stat, name=array_name_2)
1179+
call check(error, stat, "Error adding array 2 to the list of arrays.")
1180+
if (allocated(error)) return
1181+
call check(error, size(arrays) == 2, "Wrong array size.")
1182+
if (allocated(error)) return
1183+
1184+
print *, 'in test'
1185+
do j = 1, size(arrays)
1186+
print *, arrays(j)%array%name
1187+
select type (typed_array => arrays(1)%array)
1188+
class is (t_array_rdp_2)
1189+
print *, typed_array%values
1190+
class is (t_array_cdp_1)
1191+
print *, typed_array%values
1192+
class default
1193+
end select
1194+
end do
1195+
11841196
call save_npz(output_file, arrays, stat)
11851197
call check(error, stat, "Error saving arrays as an npz file.")
11861198
if (allocated(error)) then

0 commit comments

Comments
 (0)