@@ -3,6 +3,7 @@ module test_np
3
3
use stdlib_filesystem, only : temp_dir, exists
4
4
use stdlib_kinds, only : int8, int16, int32, int64, sp, dp
5
5
use stdlib_io_np, only : save_npy, load_npy, load_npz, add_array, save_npz
6
+ use stdlib_string_type, only : char
6
7
use testdrive, only : new_unittest, unittest_type, error_type, check, test_failed
7
8
implicit none
8
9
private
@@ -669,7 +670,7 @@ subroutine npz_load_nonexistent_file(error)
669
670
670
671
integer :: stat
671
672
character (* ), parameter :: filename = " nonexistent.npz"
672
- character (* ), parameter :: tmp = temp_dir// " nonexistent"
673
+ character (* ), parameter :: tmp = temp_dir// " / nonexistent"
673
674
674
675
call load_npz(filename, arrays, stat, tmp_dir= tmp)
675
676
call check(error, stat, " Loading a non-existent npz file should fail." )
@@ -683,7 +684,7 @@ subroutine npz_load_invalid_dir(error)
683
684
684
685
integer :: stat
685
686
character (* ), parameter :: filename = " ."
686
- character (* ), parameter :: tmp = temp_dir// " invalid_dir"
687
+ character (* ), parameter :: tmp = temp_dir// " / invalid_dir"
687
688
688
689
689
690
call load_npz(filename, arrays, stat, tmp_dir= tmp)
@@ -698,7 +699,7 @@ subroutine npz_load_empty_file(error)
698
699
699
700
integer :: io, stat
700
701
character (* ), parameter :: filename = " empty_file"
701
- character (* ), parameter :: tmp = temp_dir// " empty_file"
702
+ character (* ), parameter :: tmp = temp_dir// " / empty_file"
702
703
703
704
open (newunit= io, file= filename)
704
705
close (io)
@@ -717,7 +718,7 @@ subroutine npz_load_empty_zip(error)
717
718
integer :: io, stat
718
719
719
720
character (* ), parameter :: filename = " empty.zip"
720
- character (* ), parameter :: tmp = temp_dir// " empty_zip"
721
+ character (* ), parameter :: tmp = temp_dir// " / empty_zip"
721
722
character (* ), parameter :: binary_data = ' PK' // char (5 )// char (6 )// repeat (char (0 ), 18 )
722
723
723
724
open (newunit= io, file= filename, form= ' unformatted' , access= ' stream' )
@@ -736,7 +737,7 @@ subroutine npz_load_arr_empty_0(error)
736
737
type (t_array_wrapper), allocatable :: arrays(:)
737
738
integer :: stat
738
739
character (* ), parameter :: filename = " empty_0.npz"
739
- character (* ), parameter :: tmp = temp_dir// " empty_0"
740
+ character (* ), parameter :: tmp = temp_dir// " / empty_0"
740
741
character (:), allocatable :: path
741
742
742
743
@@ -762,7 +763,7 @@ subroutine npz_load_arr_rand_2_3(error)
762
763
type (t_array_wrapper), allocatable :: arrays(:)
763
764
integer :: stat
764
765
character (* ), parameter :: filename = " rand_2_3.npz"
765
- character (* ), parameter :: tmp = temp_dir// " rand_2_3"
766
+ character (* ), parameter :: tmp = temp_dir// " / rand_2_3"
766
767
character (:), allocatable :: path
767
768
768
769
path = get_path(filename)
@@ -787,7 +788,7 @@ subroutine npz_load_arr_arange_10_20(error)
787
788
type (t_array_wrapper), allocatable :: arrays(:)
788
789
integer :: stat, i
789
790
character (* ), parameter :: filename = " arange_10_20.npz"
790
- character (* ), parameter :: tmp = temp_dir// " arange_10_20"
791
+ character (* ), parameter :: tmp = temp_dir// " / arange_10_20"
791
792
792
793
character (:), allocatable :: path
793
794
@@ -820,7 +821,7 @@ subroutine npz_load_arr_cmplx(error)
820
821
type (t_array_wrapper), allocatable :: arrays(:)
821
822
integer :: stat
822
823
character (* ), parameter :: filename = " cmplx_arr.npz"
823
- character (* ), parameter :: tmp = temp_dir// " cmplx_arr"
824
+ character (* ), parameter :: tmp = temp_dir// " / cmplx_arr"
824
825
character (:), allocatable :: path
825
826
826
827
path = get_path(filename)
@@ -852,7 +853,7 @@ subroutine npz_load_two_arr_iint64_rdp(error)
852
853
type (t_array_wrapper), allocatable :: arrays(:)
853
854
integer :: stat
854
855
character (* ), parameter :: filename = " two_arr_iint64_rdp.npz"
855
- character (* ), parameter :: tmp = temp_dir// " two_arr_iint64_rdp"
856
+ character (* ), parameter :: tmp = temp_dir// " / two_arr_iint64_rdp"
856
857
character (:), allocatable :: path
857
858
858
859
path = get_path(filename)
@@ -899,7 +900,7 @@ subroutine npz_load_two_arr_iint64_rdp_comp(error)
899
900
type (t_array_wrapper), allocatable :: arrays(:)
900
901
integer :: stat
901
902
character (* ), parameter :: filename = " two_arr_iint64_rdp_comp.npz"
902
- character (* ), parameter :: tmp = temp_dir// " two_arr_iint64_rdp_comp"
903
+ character (* ), parameter :: tmp = temp_dir// " / two_arr_iint64_rdp_comp"
903
904
character (:), allocatable :: path
904
905
905
906
path = get_path(filename)
@@ -1099,7 +1100,7 @@ subroutine npz_save_one_array(error)
1099
1100
integer :: stat
1100
1101
real (dp), allocatable :: input_array(:,:)
1101
1102
character (* ), parameter :: output_file = " one_array.npz"
1102
- character (* ), parameter :: tmp = temp_dir// " one_array"
1103
+ character (* ), parameter :: tmp = temp_dir// " / one_array"
1103
1104
1104
1105
allocate (input_array(10 , 4 ))
1105
1106
call random_number (input_array)
@@ -1154,7 +1155,7 @@ subroutine npz_save_two_arrays(error)
1154
1155
character (* ), parameter :: array_name_1 = " array_1"
1155
1156
character (* ), parameter :: array_name_2 = " array_2"
1156
1157
character (* ), parameter :: output_file = " two_arrays.npz"
1157
- character (* ), parameter :: tmp = temp_dir// " two_arrays"
1158
+ character (* ), parameter :: tmp = temp_dir// " / two_arrays"
1158
1159
1159
1160
allocate (input_array_1(5 , 6 ))
1160
1161
call random_number (input_array_1)
@@ -1189,7 +1190,9 @@ subroutine npz_save_two_arrays(error)
1189
1190
1190
1191
select type (typed_array = > arrays_reloaded(1 )% array)
1191
1192
class is (t_array_rdp_2)
1192
- call check(error, size (typed_array% values), size (input_array_1), " First array does not match in size." )
1193
+ call check(error, size (typed_array% values), size (input_array_1), &
1194
+ " First array does not match in size: " // char (size (input_array_1))// " expected, " &
1195
+ // char (size (typed_array% values))// " obtained." )
1193
1196
if (allocated (error)) then
1194
1197
call delete_file(output_file); return
1195
1198
end if
@@ -1204,7 +1207,9 @@ subroutine npz_save_two_arrays(error)
1204
1207
1205
1208
select type (typed_array = > arrays_reloaded(2 )% array)
1206
1209
class is (t_array_cdp_1)
1207
- call check(error, size (typed_array% values), size (input_array_2), " Second array does not match in size." )
1210
+ call check(error, size (typed_array% values), size (input_array_2), &
1211
+ " Second array does not match in size: " // char (size (input_array_2))// " expected, " &
1212
+ // char (size (typed_array% values))// " obtained." )
1208
1213
if (allocated (error)) then
1209
1214
call delete_file(output_file); return
1210
1215
end if
0 commit comments