From 2f6b3eadf763b2e29d277904a9d9d2b35ab61023 Mon Sep 17 00:00:00 2001 From: Elena Pourmal Date: Tue, 24 Aug 2004 22:38:18 -0500 Subject: [svn-r9152] Purpose: Maintenance Description: Added new test for h5iget_file_id_f and brought back Quincey's test for h5premove_filter_f from 1.7 branch Solution: Platforms tested: OSF1 (lemieux), Solaris 2.8 (sol), AIX 5.1 (copper) Misc. update: --- fortran/test/tH5I.f90 | 18 +++++++++++++++++ fortran/test/tH5Z.f90 | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/fortran/test/tH5I.f90 b/fortran/test/tH5I.f90 index 2a4a563..94b1698 100644 --- a/fortran/test/tH5I.f90 +++ b/fortran/test/tH5I.f90 @@ -31,6 +31,7 @@ INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: new_file_id ! File identifier INTEGER(HID_T) :: group_id ! group identifier INTEGER(HID_T) :: dset_id ! Dataset identifier INTEGER(HID_T) :: dspace_id ! Dataspace identifier @@ -52,6 +53,7 @@ INTEGER :: error ! Error flag INTEGER(HSIZE_T), DIMENSION(7) :: data_dims CHARACTER(LEN=80) name_buf + CHARACTER(LEN=280) name_buf1 INTEGER(SIZE_T) buf_size INTEGER(SIZE_T) name_size INTEGER :: ref_count ! Reference count for IDs @@ -98,6 +100,20 @@ total_error = total_error + 1 endif endif + + ! + ! Get file identifier from dataset identifier and then get file name + ! + CALL h5iget_file_id_f(dset_id, new_file_id, error) + CALL check("h5iget_file_id_f",error,total_error) + name_size = 280 + CALL h5fget_name_f(new_file_id, name_buf1, name_size, error) + CALL check("h5fget_name_f",error,total_error) + if (name_buf1(1:name_size) .ne. fix_filename(1:name_size)) then + write(*,*) "h5fget_name returned wrong file name" + total_error = total_error + 1 + endif + ! ! Write data_in to the dataset @@ -207,6 +223,8 @@ ! CALL h5fclose_f(file_id, error) CALL check("h5fclose_f",error,total_error) + CALL h5fclose_f(new_file_id, error) + CALL check("h5fclose_f",error,total_error) ! ! Basic Test of increment/decrement ID functions diff --git a/fortran/test/tH5Z.f90 b/fortran/test/tH5Z.f90 index 8d6ba8c..41bcfd6 100644 --- a/fortran/test/tH5Z.f90 +++ b/fortran/test/tH5Z.f90 @@ -24,6 +24,7 @@ LOGICAL :: status, status1 INTEGER(HID_T) :: crtpr_id, xfer_id INTEGER :: error + INTEGER :: nfilters INTEGER(HSIZE_T) :: ch_dims(2) INTEGER :: RANK = 2 INTEGER :: dlevel = 6 @@ -92,6 +93,58 @@ endif +! +! Verify h5premove_filter_f +! + CALL h5zfilter_avail_f(H5Z_FILTER_FLETCHER32_F, status, error) + CALL check("h5zfilter_avail_f", error, total_error) + if(status) then + CALL h5zfilter_avail_f(H5Z_FILTER_SHUFFLE_F, status, error) + CALL check("h5zfilter_avail_f", error, total_error) + if(status) then + CALL h5pcreate_f(H5P_DATASET_CREATE_F, crtpr_id, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_fletcher32_f(crtpr_id, error) + CALL check("h5pset_fletcher32_f", error, total_error) + CALL h5pset_shuffle_f(crtpr_id, error) + CALL check("h5pset_shuffle_f", error, total_error) + CALL h5pget_nfilters_f(crtpr_id, nfilters, error) + CALL check("h5pget_nfilters_f", error, total_error) + + ! Verify the correct number of filters + if (nfilters .ne. 2) then + write(*,*) "number of filters is wrong" + total_error = total_error + 1 + endif + + ! Delete a single filter + CALL h5premove_filter_f(crtpr_id, H5Z_FILTER_SHUFFLE_F, error) + CALL check("h5pset_shuffle_f", error, total_error) + + ! Verify the correct number of filters now + CALL h5pget_nfilters_f(crtpr_id, nfilters, error) + CALL check("h5pget_nfilters_f", error, total_error) + if (nfilters .ne. 1) then + write(*,*) "number of filters is wrong" + total_error = total_error + 1 + endif + + ! Delete all filters + CALL h5premove_filter_f(crtpr_id, H5Z_FILTER_ALL_F, error) + CALL check("h5premove_filter_f", error, total_error) + + ! Verify the correct number of filters now + CALL h5pget_nfilters_f(crtpr_id, nfilters, error) + CALL check("h5pget_nfilters_f", error, total_error) + if (nfilters .ne. 0) then + write(*,*) "number of filters is wrong" + total_error = total_error + 1 + endif + CALL h5pclose_f(crtpr_id,error) + CALL check("h5pclose_f", error, total_error) + endif + endif + RETURN END SUBROUTINE filters_test -- cgit v0.12