@@ -9,6 +9,8 @@ module test_np
9
9
10
10
public :: collect_np
11
11
12
+ character (* ), parameter :: path_to_zip_files = " test/io/zip_files/"
13
+
12
14
contains
13
15
14
16
! > Collect all exported unit tests
@@ -737,10 +739,8 @@ subroutine npz_load_arr_empty_0(error)
737
739
integer :: stat
738
740
character (* ), parameter :: filename = " empty_0.npz"
739
741
character (* ), parameter :: tmp = temp_dir// " /empty_0"
740
- character (:), allocatable :: path
741
-
742
+ character (* ), parameter :: path = path_to_zip_files// filename
742
743
743
- path = get_path(filename)
744
744
call load_npz(path, arrays, stat, tmp_dir= tmp)
745
745
call check(error, stat, " Loading an npz that contains a single empty array shouldn't fail." )
746
746
if (allocated (error)) return
@@ -763,9 +763,8 @@ subroutine npz_load_arr_rand_2_3(error)
763
763
integer :: stat
764
764
character (* ), parameter :: filename = " rand_2_3.npz"
765
765
character (* ), parameter :: tmp = temp_dir// " /rand_2_3"
766
- character (: ), allocatable :: path
766
+ character (* ), parameter :: path = path_to_zip_files // filename
767
767
768
- path = get_path(filename)
769
768
call load_npz(path, arrays, stat, tmp_dir= tmp)
770
769
call check(error, stat, " Loading an npz file that contains a valid nd_array shouldn't fail." )
771
770
if (allocated (error)) return
@@ -788,10 +787,8 @@ subroutine npz_load_arr_arange_10_20(error)
788
787
integer :: stat, i
789
788
character (* ), parameter :: filename = " arange_10_20.npz"
790
789
character (* ), parameter :: tmp = temp_dir// " /arange_10_20"
790
+ character (* ), parameter :: path = path_to_zip_files// filename
791
791
792
- character (:), allocatable :: path
793
-
794
- path = get_path(filename)
795
792
call load_npz(path, arrays, stat, tmp_dir= tmp)
796
793
call check(error, stat, " Loading an npz file that contains a valid nd_array shouldn't fail." )
797
794
if (allocated (error)) return
@@ -821,9 +818,8 @@ subroutine npz_load_arr_cmplx(error)
821
818
integer :: stat
822
819
character (* ), parameter :: filename = " cmplx_arr.npz"
823
820
character (* ), parameter :: tmp = temp_dir// " /cmplx_arr"
824
- character (: ), allocatable :: path
821
+ character (* ), parameter :: path = path_to_zip_files // filename
825
822
826
- path = get_path(filename)
827
823
call load_npz(path, arrays, stat, tmp_dir= tmp)
828
824
call check(error, stat, " Loading an npz file that contains a valid nd_array shouldn't fail." )
829
825
if (allocated (error)) return
@@ -853,9 +849,8 @@ subroutine npz_load_two_arr_iint64_rdp(error)
853
849
integer :: stat
854
850
character (* ), parameter :: filename = " two_arr_iint64_rdp.npz"
855
851
character (* ), parameter :: tmp = temp_dir// " /two_arr_iint64_rdp"
856
- character (: ), allocatable :: path
852
+ character (* ), parameter :: path = path_to_zip_files // filename
857
853
858
- path = get_path(filename)
859
854
call load_npz(path, arrays, stat, tmp_dir= tmp)
860
855
call check(error, stat, " Loading an npz file that contains valid nd_arrays shouldn't fail." )
861
856
if (allocated (error)) return
@@ -900,9 +895,8 @@ subroutine npz_load_two_arr_iint64_rdp_comp(error)
900
895
integer :: stat
901
896
character (* ), parameter :: filename = " two_arr_iint64_rdp_comp.npz"
902
897
character (* ), parameter :: tmp = temp_dir// " /two_arr_iint64_rdp_comp"
903
- character (: ), allocatable :: path
898
+ character (* ), parameter :: path = path_to_zip_files // filename
904
899
905
- path = get_path(filename)
906
900
call load_npz(path, arrays, stat, tmp_dir= tmp)
907
901
call check(error, stat, " Loading a compressed npz file that contains valid nd_arrays shouldn't fail." )
908
902
if (allocated (error)) return
@@ -1220,18 +1214,6 @@ subroutine npz_save_two_arrays(error)
1220
1214
call delete_file(output_file)
1221
1215
end
1222
1216
1223
- ! > Makes sure that we find the file when running both `ctest` and `fpm test`.
1224
- function get_path (file ) result(path)
1225
- character (* ), intent (in ) :: file
1226
- character (:), allocatable :: path
1227
-
1228
- #ifdef TEST_ROOT_DIR
1229
- path = TEST_ROOT_DIR// ' /io/zip_files/' // file
1230
- #else
1231
- path = ' test/io/zip_files/' // file
1232
- #endif
1233
- end
1234
-
1235
1217
subroutine delete_file (filename )
1236
1218
character (len=* ), intent (in ) :: filename
1237
1219
0 commit comments