summaryrefslogtreecommitdiffstats
path: root/fortran/test
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2003-03-19 16:13:57 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2003-03-19 16:13:57 (GMT)
commite10de8f3d65bd8ad0ef5484a56f1a9807693a967 (patch)
treeb5de5dabf4968cc34a8dca67bd896ef14728b28a /fortran/test
parent65f5514a4ff647cff51c37e3af30d5e138733d06 (diff)
downloadhdf5-e10de8f3d65bd8ad0ef5484a56f1a9807693a967.zip
hdf5-e10de8f3d65bd8ad0ef5484a56f1a9807693a967.tar.gz
hdf5-e10de8f3d65bd8ad0ef5484a56f1a9807693a967.tar.bz2
[svn-r6495]
Purpose: Catching up with the C library Description: Added tests for the follwoing new fortran functions h5iget_name_f h5tis_variavle_str_f h5zunregister_f h5zfilter_avail_f h5pset_shuffle_f h5pset_fletcher32 h5pset_edc_check_f h5pget_edc_check_f h5dfill_f Solution: Platforms tested: arabica(C and F90), burrwhite (pgcc and pgf90), modi4 (F90 and parallel) Misc. update:
Diffstat (limited to 'fortran/test')
-rw-r--r--fortran/test/Makefile.in2
-rw-r--r--fortran/test/fortranlib_test.f909
-rw-r--r--fortran/test/tH5I.f9018
-rw-r--r--fortran/test/tH5VL.f9024
-rw-r--r--fortran/test/tH5Z.f9084
5 files changed, 135 insertions, 2 deletions
diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in
index 8670f57..92032ea 100644
--- a/fortran/test/Makefile.in
+++ b/fortran/test/Makefile.in
@@ -36,7 +36,7 @@ LIB_OBJ=$(LIB_FSRC:.f90=.lo) $(LIB_CSRC:.c=.lo)
TEST_PROGS_SRC=fortranlib_test.f90 fflush1.f90 fflush2.f90
TEST_PROGS=$(TEST_PROGS_SRC:.f90=)
-TEST_FSRC= tH5F.f90 tH5D.f90 tH5R.f90 tH5S.f90 tH5T.f90 tH5VL.f90\
+TEST_FSRC= tH5F.f90 tH5D.f90 tH5R.f90 tH5S.f90 tH5T.f90 tH5VL.f90 tH5Z.f90\
tH5Sselect.f90 tH5P.f90 tH5A.f90 tH5I.f90 tH5G.f90 tH5E.f90 tf.f90
TEST_CSRC = t.c
TEST_OBJ=$(TEST_FSRC:.f90=.lo) $(TEST_CSRC:.c=.lo)
diff --git a/fortran/test/fortranlib_test.f90 b/fortran/test/fortranlib_test.f90
index d588987..b41de81 100644
--- a/fortran/test/fortranlib_test.f90
+++ b/fortran/test/fortranlib_test.f90
@@ -44,6 +44,7 @@
INTEGER :: group_total_error = 0
INTEGER :: error_total_error = 0
INTEGER :: vl_total_error = 0
+ INTEGER :: z_total_error = 0
INTEGER :: majnum, minnum, relnum
CHARACTER(LEN=8) error_string
CHARACTER(LEN=8) :: success = ' PASSED '
@@ -256,6 +257,14 @@
write(*, fmt = e_format) error_string
total_error = total_error + identifier_total_error
+ error_string = failure
+ CALL filters_test(cleanup, z_total_error)
+ IF (z_total_error == 0) error_string = success
+ write(*, fmt = '(13a)', advance = 'no') ' Filters test'
+ write(*, fmt = '(57x,a)', advance = 'no') ' '
+ write(*, fmt = e_format) error_string
+ total_error = total_error + z_total_error
+
! write(*,*)
! write(*,*) '========================================='
! write(*,*) 'Testing GROUP interface '
diff --git a/fortran/test/tH5I.f90 b/fortran/test/tH5I.f90
index 7fd2edc..3c5855b 100644
--- a/fortran/test/tH5I.f90
+++ b/fortran/test/tH5I.f90
@@ -11,7 +11,7 @@
CHARACTER(LEN=6), PARAMETER :: filename = "itestf" ! File name
CHARACTER(LEN=80) :: fix_filename
- CHARACTER(LEN=9), PARAMETER :: dsetname = "itestdset" ! Dataset name
+ CHARACTER(LEN=10), PARAMETER :: dsetname = "/itestdset" ! Dataset name
CHARACTER(LEN=10), PARAMETER :: groupname = "itestgroup"! group name
CHARACTER(LEN=10), PARAMETER :: aname = "itestattr"! group name
@@ -38,6 +38,9 @@
INTEGER :: type !object identifier
INTEGER :: error ! Error flag
INTEGER, DIMENSION(7) :: data_dims
+ CHARACTER(LEN=80) name_buf
+ INTEGER(SIZE_T) buf_size
+ INTEGER(SIZE_T) name_size
!
@@ -69,6 +72,19 @@
CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, &
dset_id, error)
CALL check("h5dcreate_f",error,total_error)
+ buf_size = 80
+ CALL h5iget_name_f(dset_id, name_buf, buf_size, name_size, error)
+ CALL check("h5iget_name_f",error,total_error)
+ if (name_size .ne. len(dsetname)) then
+ write(*,*) "h5iget_name returned wrong name size"
+ total_error = total_error + 1
+ goto 100
+ endif
+ if (name_buf(1:name_size) .ne. dsetname) then
+ write(*,*) "h5iget_name returned wrong name"
+ total_error = total_error + 1
+ endif
+100 continue
!
! Write data_in to the dataset
diff --git a/fortran/test/tH5VL.f90 b/fortran/test/tH5VL.f90
index 04de247..0dd909f 100644
--- a/fortran/test/tH5VL.f90
+++ b/fortran/test/tH5VL.f90
@@ -208,6 +208,8 @@
INTEGER :: i, j !general purpose integers
INTEGER(HSIZE_T), DIMENSION(2) :: data_dims = (/5,6/)
INTEGER(SIZE_T) max_len
+ INTEGER(HID_T) :: vl_type_id
+ LOGICAL :: vl_flag
!
! Initialize the vl_int_data array.
@@ -257,6 +259,15 @@
CALL h5dcreate_f(file_id, dsetname, vltype_id, dspace_id, &
dset_id, error)
CALL check("h5dcreate_f", error, total_error)
+ CALL h5dget_type_f(dset_id, vl_type_id, error)
+ CALL check("h5dget_type_f", error, total_error)
+ CALL h5tis_variable_str_f( vl_type_id, vl_flag, error)
+ CALL check("h5tis_variable_str_f", error, total_error)
+ if( vl_flag ) then
+ write(*,*) "type is wrong"
+ total_error = total_error + 1
+ endif
+
!
! Write the dataset.
@@ -368,6 +379,8 @@
INTEGER :: i, j !general purpose integers
INTEGER(HSIZE_T), DIMENSION(2) :: data_dims = (/10,4/)
+ INTEGER(HID_T) :: vl_type_id
+ LOGICAL :: vl_flag
!
! Initialize the string_data array.
@@ -407,6 +420,17 @@
CALL h5dcreate_f(file_id, dsetname, H5T_STRING, dspace_id, &
dset_id, error)
CALL check("h5dcreate_f", error, total_error)
+ !
+ ! Check that dataset has a string datatype
+ !
+ CALL h5dget_type_f(dset_id, vl_type_id, error)
+ CALL check("h5dget_type_f", error, total_error)
+ CALL h5tis_variable_str_f( vl_type_id, vl_flag, error)
+ CALL check("h5tis_variable_str_f", error, total_error)
+ if( .NOT. vl_flag ) then
+ write(*,*) "type is wrong"
+ total_error = total_error + 1
+ endif
!
! Write the dataset.
diff --git a/fortran/test/tH5Z.f90 b/fortran/test/tH5Z.f90
new file mode 100644
index 0000000..921bbd1
--- /dev/null
+++ b/fortran/test/tH5Z.f90
@@ -0,0 +1,84 @@
+
+ SUBROUTINE filters_test(cleanup, total_error)
+
+! This subroutine tests following functionalities: h5zfilter_avail_f, h5zunregister_f
+
+ USE HDF5 ! This module contains all necessary modules
+
+ IMPLICIT NONE
+ LOGICAL, INTENT(IN) :: cleanup
+ INTEGER, INTENT(OUT) :: total_error
+ LOGICAL :: status, status1
+ INTEGER(HID_T) :: crtpr_id, xfer_id
+ INTEGER :: error
+ INTEGER(HSIZE_T) :: ch_dims(2)
+ INTEGER :: RANK = 2
+ INTEGER :: dlevel = 6
+ INTEGER :: tsize = 4
+ INTEGER :: edc_flag
+
+ ch_dims(1) = 10
+ ch_dims(2) = 3
+!
+! Deflate filter
+!
+ CALL h5zfilter_avail_f(H5Z_FILTER_DEFLATE_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_chunk_f(crtpr_id, RANK, ch_dims, error)
+ CALL check("h5pset_chunk_f",error, total_error)
+ CALL h5pset_deflate_f(crtpr_id, dlevel, error)
+ CALL check("h5pset_deflate_f", error, total_error)
+ CALL h5pclose_f(crtpr_id,error)
+ CALL check("h5pclose_f", error, total_error)
+ endif
+
+!
+! Shuffle filter
+!
+ 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_chunk_f(crtpr_id, RANK, ch_dims, error)
+ CALL check("h5pset_chunk_f",error, total_error)
+ CALL h5pset_shuffle_f(crtpr_id, tsize, error)
+ CALL check("h5pset_shuffle_f", error, total_error)
+ CALL h5pclose_f(crtpr_id,error)
+ CALL check("h5pclose_f", error, total_error)
+ endif
+
+!
+! Checksum filter
+!
+ CALL h5zfilter_avail_f(H5Z_FILTER_FLETCHER32_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_chunk_f(crtpr_id, RANK, ch_dims, error)
+ CALL check("h5pset_chunk_f",error, total_error)
+ CALL h5pset_fletcher32_f(crtpr_id, error)
+ CALL check("h5pset_fletcher32_f", error, total_error)
+ CALL h5pclose_f(crtpr_id,error)
+ CALL check("h5pclose_f", error, total_error)
+ CALL h5pcreate_f(H5P_DATASET_XFER_F, xfer_id, error)
+ CALL check("h5pcreate_f", error, total_error)
+ CALL h5pset_edc_check_f( xfer_id, H5Z_DISABLE_EDC_F, error)
+ CALL check("h5pset_edc_check_f", error, total_error)
+ CALL h5pget_edc_check_f( xfer_id, edc_flag, error)
+ CALL check("h5pget_edc_check_f", error, total_error)
+ if (edc_flag .ne. H5Z_DISABLE_EDC_F) then
+ write(*,*) "EDC status is wrong"
+ total_error = total_error + 1
+ endif
+ CALL h5pclose_f(xfer_id, error)
+ CALL check("h5pclose_f", error, total_error)
+
+ endif
+
+ RETURN
+ END SUBROUTINE filters_test