diff options
-rw-r--r-- | fortran/test/Makefile.in | 2 | ||||
-rw-r--r-- | fortran/test/fortranlib_test.f90 | 9 | ||||
-rw-r--r-- | fortran/test/tH5E.f90 | 44 |
3 files changed, 54 insertions, 1 deletions
diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index cb3af45..ba4b919 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -21,7 +21,7 @@ TEST_PROGS_SRC=fortranlib_test.f90 fflush1.f90 fflush2.f90 TEST_PROGS=$(TEST_PROGS_SRC:.f90=) TEST_SRC=hdf5test.f90 tH5F.f90 tH5D.f90 tH5R.f90 tH5S.f90 tH5T.f90 \ - tH5Sselect.f90 tH5P.f90 tH5A.f90 tH5I.f90 tH5G.f90 + tH5Sselect.f90 tH5P.f90 tH5A.f90 tH5I.f90 tH5G.f90 tH5E.f90 TEST_OBJ=$(TEST_SRC:.f90=.lo) DISTCLEAN=$(TEST_PROGS_SRC:.f90=.lo) $(TEST_PROGS_SRC:.f90=.o) *.h5 diff --git a/fortran/test/fortranlib_test.f90 b/fortran/test/fortranlib_test.f90 index 07a17b0..13e96b0 100644 --- a/fortran/test/fortranlib_test.f90 +++ b/fortran/test/fortranlib_test.f90 @@ -25,6 +25,7 @@ INTEGER :: attribute_total_error = 0 INTEGER :: identifier_total_error = 0 INTEGER :: group_total_error = 0 + INTEGER :: error_total_error = 0 CHARACTER*8 error_string CHARACTER*8 :: success = ' PASSED ' CHARACTER*8 :: failure = '*FAILED*' @@ -215,6 +216,14 @@ write(*, fmt = e_format) error_string total_error = total_error + identifier_total_error + error_string = failure + CALL error_report_test(error_total_error) + IF (error_total_error == 0) error_string = success + write(*, fmt = '(11a)', advance = 'no') ' Error test' + write(*, fmt = '(59x,a)', advance = 'no') ' ' + write(*, fmt = e_format) error_string + total_error = total_error + error_total_error + write(*,*) write(*,*) ' ============================================ ' diff --git a/fortran/test/tH5E.f90 b/fortran/test/tH5E.f90 new file mode 100644 index 0000000..c14b101 --- /dev/null +++ b/fortran/test/tH5E.f90 @@ -0,0 +1,44 @@ + SUBROUTINE error_report_test(total_error) + +!THis subroutine tests following functionalities: h5eprint_f + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=9), PARAMETER :: filename = "etestf.h5" ! File name + CHARACTER(LEN=12), PARAMETER :: err_file_name = "err_file.tmp"! Error output file + + + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: grp_id ! Group identifier + INTEGER :: error, tmp_error, err_flag + + err_flag = 0 + CALL h5eset_auto_f(err_flag, error) + CALL check("h5eprint_f",error, total_error) + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + CALL check("h5fcreate_f",error,total_error) + + ! + ! Try to open non-existing group in the file. + ! Error message should go to the err_file_name file. + ! + CALL h5gopen_f(file_id, "Doesnotexist1", grp_id, tmp_error) + CALL h5eprint_f(error, err_file_name) + CALL h5gopen_f(file_id, "Doesnotexist2", grp_id, tmp_error) + CALL h5eprint_f(error, err_file_name) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f",error,total_error) + + RETURN + END SUBROUTINE error_report_test |