@@ -45,7 +45,8 @@ subroutine collect_np(testsuite)
45
45
new_unittest(" npz_load_arr_rand_2_3" , npz_load_arr_rand_2_3), &
46
46
new_unittest(" npz_load_arr_arange_10_20" , npz_load_arr_arange_10_20), &
47
47
new_unittest(" npz_load_arr_cmplx" , npz_load_arr_cmplx), &
48
- new_unittest(" npz_load_two_arr_iint64_rdp" , npz_load_two_arr_iint64_rdp) &
48
+ new_unittest(" npz_load_two_arr_iint64_rdp" , npz_load_two_arr_iint64_rdp), &
49
+ new_unittest(" npz_load_two_arr_iint64_rdp_comp" , npz_load_two_arr_iint64_rdp_comp) &
49
50
]
50
51
end subroutine collect_np
51
52
@@ -798,7 +799,7 @@ subroutine npz_load_arr_cmplx(error)
798
799
type (error_type), allocatable , intent (out ) :: error
799
800
800
801
type (t_array_wrapper), allocatable :: arrays(:)
801
- integer :: stat, i
802
+ integer :: stat
802
803
character (* ), parameter :: filename = " cmplx_arr.npz"
803
804
character (:), allocatable :: path
804
805
@@ -829,13 +830,59 @@ subroutine npz_load_two_arr_iint64_rdp(error)
829
830
type (error_type), allocatable , intent (out ) :: error
830
831
831
832
type (t_array_wrapper), allocatable :: arrays(:)
832
- integer :: stat, i
833
+ integer :: stat
833
834
character (* ), parameter :: filename = " two_arr_iint64_rdp.npz"
834
835
character (:), allocatable :: path
835
836
836
837
path = get_path(filename)
837
838
call load_npz(path, arrays, stat)
838
- call check(error, stat, " Loading an npz file that contains a valid nd_array shouldn't fail." )
839
+ call check(error, stat, " Loading an npz file that contains valid nd_arrays shouldn't fail." )
840
+ if (stat /= 0 ) return
841
+ call check(error, size (arrays) == 2 , " '" // filename// " ' is supposed to contain two arrays." )
842
+ if (size (arrays) /= 2 ) return
843
+ call check(error, arrays(1 )% array% name == " arr_0.npy" , " Wrong array name." )
844
+ if (arrays(1 )% array% name /= " arr_0.npy" ) return
845
+ call check(error, arrays(2 )% array% name == " arr_1.npy" , " Wrong array name." )
846
+ if (arrays(2 )% array% name /= " arr_1.npy" ) return
847
+ select type (typed_array = > arrays(1 )% array)
848
+ class is (t_array_iint64_1)
849
+ call check(error, size (typed_array% values) == 3 , " Array in '" // filename// " ' is supposed to have 3 entries." )
850
+ if (size (typed_array% values) /= 3 ) return
851
+ call check(error, typed_array% values(1 ) == 1 , " First integer does not match." )
852
+ if (typed_array% values(1 ) /= 1 ) return
853
+ call check(error, typed_array% values(2 ) == 2 , " Second integer does not match." )
854
+ if (typed_array% values(2 ) /= 2 ) return
855
+ call check(error, typed_array% values(3 ) == 3 , " Third integer does not match." )
856
+ if (typed_array% values(3 ) /= 3 ) return
857
+ class default
858
+ call test_failed(error, " Array in '" // filename// " ' is of wrong type." )
859
+ end select
860
+ select type (typed_array = > arrays(2 )% array)
861
+ class is (t_array_rdp_1)
862
+ call check(error, size (typed_array% values) == 3 , " Array in '" // filename// " ' is supposed to have 3 entries." )
863
+ if (size (typed_array% values) /= 3 ) return
864
+ call check(error, typed_array% values(1 ) == 1 ., " First number does not match." )
865
+ if (typed_array% values(1 ) /= 1 .) return
866
+ call check(error, typed_array% values(2 ) == 1 ., " Second number does not match." )
867
+ if (typed_array% values(2 ) /= 1 .) return
868
+ call check(error, typed_array% values(3 ) == 1 ., " Third number does not match." )
869
+ if (typed_array% values(3 ) /= 1 .) return
870
+ class default
871
+ call test_failed(error, " Array in '" // filename// " ' is of wrong type." )
872
+ end select
873
+ end
874
+
875
+ subroutine npz_load_two_arr_iint64_rdp_comp (error )
876
+ type (error_type), allocatable , intent (out ) :: error
877
+
878
+ type (t_array_wrapper), allocatable :: arrays(:)
879
+ integer :: stat, i
880
+ character (* ), parameter :: filename = " two_arr_iint64_rdp_comp.npz"
881
+ character (:), allocatable :: path
882
+
883
+ path = get_path(filename)
884
+ call load_npz(path, arrays, stat)
885
+ call check(error, stat, " Loading a compressed npz file that contains valid nd_arrays shouldn't fail." )
839
886
if (stat /= 0 ) return
840
887
call check(error, size (arrays) == 2 , " '" // filename// " ' is supposed to contain two arrays." )
841
888
if (size (arrays) /= 2 ) return
0 commit comments