@@ -9,6 +9,8 @@ module test_np
99
1010 public :: collect_np
1111
12+ character (* ), parameter :: path_to_zip_files = " test/io/zip_files/"
13+
1214contains
1315
1416 ! > Collect all exported unit tests
@@ -737,10 +739,8 @@ subroutine npz_load_arr_empty_0(error)
737739 integer :: stat
738740 character (* ), parameter :: filename = " empty_0.npz"
739741 character (* ), parameter :: tmp = temp_dir// " /empty_0"
740- character (:), allocatable :: path
741-
742+ character (* ), parameter :: path = path_to_zip_files// filename
742743
743- path = get_path(filename)
744744 call load_npz(path, arrays, stat, tmp_dir= tmp)
745745 call check(error, stat, " Loading an npz that contains a single empty array shouldn't fail." )
746746 if (allocated (error)) return
@@ -763,9 +763,8 @@ subroutine npz_load_arr_rand_2_3(error)
763763 integer :: stat
764764 character (* ), parameter :: filename = " rand_2_3.npz"
765765 character (* ), parameter :: tmp = temp_dir// " /rand_2_3"
766- character (: ), allocatable :: path
766+ character (* ), parameter :: path = path_to_zip_files // filename
767767
768- path = get_path(filename)
769768 call load_npz(path, arrays, stat, tmp_dir= tmp)
770769 call check(error, stat, " Loading an npz file that contains a valid nd_array shouldn't fail." )
771770 if (allocated (error)) return
@@ -788,10 +787,8 @@ subroutine npz_load_arr_arange_10_20(error)
788787 integer :: stat, i
789788 character (* ), parameter :: filename = " arange_10_20.npz"
790789 character (* ), parameter :: tmp = temp_dir// " /arange_10_20"
790+ character (* ), parameter :: path = path_to_zip_files// filename
791791
792- character (:), allocatable :: path
793-
794- path = get_path(filename)
795792 call load_npz(path, arrays, stat, tmp_dir= tmp)
796793 call check(error, stat, " Loading an npz file that contains a valid nd_array shouldn't fail." )
797794 if (allocated (error)) return
@@ -821,9 +818,8 @@ subroutine npz_load_arr_cmplx(error)
821818 integer :: stat
822819 character (* ), parameter :: filename = " cmplx_arr.npz"
823820 character (* ), parameter :: tmp = temp_dir// " /cmplx_arr"
824- character (: ), allocatable :: path
821+ character (* ), parameter :: path = path_to_zip_files // filename
825822
826- path = get_path(filename)
827823 call load_npz(path, arrays, stat, tmp_dir= tmp)
828824 call check(error, stat, " Loading an npz file that contains a valid nd_array shouldn't fail." )
829825 if (allocated (error)) return
@@ -853,9 +849,8 @@ subroutine npz_load_two_arr_iint64_rdp(error)
853849 integer :: stat
854850 character (* ), parameter :: filename = " two_arr_iint64_rdp.npz"
855851 character (* ), parameter :: tmp = temp_dir// " /two_arr_iint64_rdp"
856- character (: ), allocatable :: path
852+ character (* ), parameter :: path = path_to_zip_files // filename
857853
858- path = get_path(filename)
859854 call load_npz(path, arrays, stat, tmp_dir= tmp)
860855 call check(error, stat, " Loading an npz file that contains valid nd_arrays shouldn't fail." )
861856 if (allocated (error)) return
@@ -900,9 +895,8 @@ subroutine npz_load_two_arr_iint64_rdp_comp(error)
900895 integer :: stat
901896 character (* ), parameter :: filename = " two_arr_iint64_rdp_comp.npz"
902897 character (* ), parameter :: tmp = temp_dir// " /two_arr_iint64_rdp_comp"
903- character (: ), allocatable :: path
898+ character (* ), parameter :: path = path_to_zip_files // filename
904899
905- path = get_path(filename)
906900 call load_npz(path, arrays, stat, tmp_dir= tmp)
907901 call check(error, stat, " Loading a compressed npz file that contains valid nd_arrays shouldn't fail." )
908902 if (allocated (error)) return
@@ -1220,18 +1214,6 @@ subroutine npz_save_two_arrays(error)
12201214 call delete_file(output_file)
12211215 end
12221216
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-
12351217 subroutine delete_file (filename )
12361218 character (len=* ), intent (in ) :: filename
12371219
0 commit comments