Skip to content

Commit 0331beb

Browse files
committed
Finish seconds test
1 parent ec5f4b6 commit 0331beb

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/stdlib_io_np_save.fypp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ contains
164164
t_arr%name = name
165165
else
166166
if (allocated(arrays)) then
167-
t_arr%name = "arr_"//trim(to_string(size(arrays)))//".npy"
167+
t_arr%name = "arr_"//to_string(size(arrays))//".npy"
168168
else
169169
t_arr%name = "arr_0.npy"
170170
end if

test/io/test_np.f90

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ subroutine npz_add_two_arrays(error)
974974
allocate(array_1(10, 4))
975975
call random_number(array_1)
976976
call add_array(arrays, array_1, stat)
977-
call check(error, stat, "Error adding an array to the list of arrays.")
977+
call check(error, stat, "Error adding the first array to the list of arrays.")
978978
if (allocated(error)) return
979979
call check(error, size(arrays) == 1, "Array was not added to the list of arrays.")
980980
if (allocated(error)) return
@@ -994,7 +994,22 @@ subroutine npz_add_two_arrays(error)
994994
allocate(array_2(10))
995995
call random_number(array_2)
996996
call add_array(arrays, array_2, stat)
997-
call check(error, stat, "Error adding an array to the list of arrays.")
997+
call check(error, stat, "Error adding the second array to the list of arrays.")
998+
if (allocated(error)) return
999+
call check(error, size(arrays) == 2, "Array was not added to the list of arrays.")
1000+
if (allocated(error)) return
1001+
call check(error, arrays(2)%array%name == "arr_1.npy", "Wrong array name.")
1002+
if (allocated(error)) return
1003+
select type (typed_array => arrays(2)%array)
1004+
class is (t_array_rsp_1)
1005+
call check(error, size(typed_array%values), size(array_2), "Array sizes to not match.")
1006+
if (allocated(error)) return
1007+
call check(error, any(abs(typed_array%values - array_2) <= epsilon(1.0_sp)), &
1008+
"Precision loss when adding array.")
1009+
if (allocated(error)) return
1010+
class default
1011+
call test_failed(error, "Array 2 is of wrong type.")
1012+
end select
9981013
end
9991014

10001015
! subroutine npz_add_arr(error)

0 commit comments

Comments
 (0)