summaryrefslogtreecommitdiffstats
path: root/fortran/test
diff options
context:
space:
mode:
Diffstat (limited to 'fortran/test')
-rw-r--r--fortran/test/fortranlib_test.f9076
-rw-r--r--fortran/test/tH5A.f9049
2 files changed, 74 insertions, 51 deletions
diff --git a/fortran/test/fortranlib_test.f90 b/fortran/test/fortranlib_test.f90
index 2724dad..7e57b21 100644
--- a/fortran/test/fortranlib_test.f90
+++ b/fortran/test/fortranlib_test.f90
@@ -27,29 +27,29 @@
CHARACTER*8 error_string
CHARACTER*8 :: success = ' PASSED '
CHARACTER*8 :: failure = '*FAILED*'
- CHARACTER*2 :: e_format = "a8"
+ CHARACTER*4 :: e_format ='(8a)'
CALL h5init_types_f(error)
- write(*,*) '============================================================================='
+ write(*,*) ' ========================== '
write(*,*) ' FORTRAN tests '
- write(*,*) '============================================================================='
+ write(*,*) ' ========================== '
! write(*,*) '========================================='
! write(*,*) 'Testing FILE Interface '
! write(*,*) '========================================='
- write(*, fmt = '14a', advance = 'no') ' Mounting test'
- write(*, fmt = '57x', advance = 'no')
error_string = failure
CALL mountingtest(mounting_total_error)
IF (mounting_total_error == 0) error_string = success
+ write(*, fmt = '(14a)', advance = 'no') ' Mounting test'
+ write(*, fmt = '(57x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + mounting_total_error
- write(*, fmt = '12a', advance = 'no') ' Reopen test'
- write(*, fmt = '59x', advance = 'no')
error_string = failure
CALL reopentest(reopen_total_error)
IF (reopen_total_error == 0) error_string = success
+ write(*, fmt = '(12a)', advance = 'no') ' Reopen test'
+ write(*, fmt = '(59x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + reopen_total_error
@@ -59,19 +59,19 @@
! write(*,*) 'Testing DATASET Interface '
! write(*,*) '========================================='
- write(*, fmt = '13a', advance = 'no') ' Dataset test'
- write(*, fmt = '58x', advance = 'no')
error_string = failure
CALL datasettest(dataset_total_error)
IF (dataset_total_error == 0) error_string = success
+ write(*, fmt = '(13a)', advance = 'no') ' Dataset test'
+ write(*, fmt = '(58x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + dataset_total_error
- write(*, fmt = '24a', advance = 'no') ' Extendible dataset test'
- write(*, fmt = '47x', advance = 'no')
error_string = failure
CALL extenddsettest(extend_dataset_total_error)
IF (extend_dataset_total_error == 0) error_string = success
+ write(*, fmt = '(24a)', advance = 'no') ' Extendible dataset test'
+ write(*, fmt = '(47x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + extend_dataset_total_error
@@ -80,11 +80,11 @@
! write(*,*) 'Testing DATASPACE Interface '
! write(*,*) '========================================='
- write(*, fmt = '21a', advance = 'no') ' Basic dataspace test'
- write(*, fmt = '50x', advance = 'no')
error_string = failure
CALL dataspace_basic_test(dataspace_total_error)
IF (dataspace_total_error == 0) error_string = success
+ write(*, fmt = '(21a)', advance = 'no') ' Basic dataspace test'
+ write(*, fmt = '(50x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + dataspace_total_error
@@ -94,19 +94,19 @@
! write(*,*) 'Testing REFERENCE Interface '
! write(*,*) '========================================='
- write(*, fmt = '25a', advance = 'no') ' Reference to object test'
- write(*, fmt = '46x', advance = 'no')
error_string = failure
CALL refobjtest(refobj_total_error)
IF (refobj_total_error == 0) error_string = success
+ write(*, fmt = '(25a)', advance = 'no') ' Reference to object test'
+ write(*, fmt = '(46x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + refobj_total_error
- write(*, fmt = '33a', advance = 'no') ' Reference to dataset region test'
- write(*, fmt = '38x', advance = 'no')
error_string = failure
CALL refregtest(refreg_total_error)
IF (refreg_total_error == 0) error_string = success
+ write(*, fmt = '(33a)', advance = 'no') ' Reference to dataset region test'
+ write(*, fmt = '(38x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + refreg_total_error
@@ -115,27 +115,27 @@
! write(*,*) 'Testing selection functionalities '
! write(*,*) '========================================='
- write(*, fmt = '21a', advance = 'no') ' Basic selection test'
- write(*, fmt = '50x', advance = 'no')
error_string = failure
CALL test_basic_select(basic_select_total_error)
IF (basic_select_total_error == 0) error_string = success
+ write(*, fmt = '(21a)', advance = 'no') ' Basic selection test'
+ write(*, fmt = '(50x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + basic_select_total_error
- write(*, fmt = '25a', advance = 'no') ' Hyperslab selection test'
- write(*, fmt = '46x', advance = 'no')
error_string = failure
CALL test_select_hyperslab( hyperslab_total_error)
IF ( hyperslab_total_error == 0) error_string = success
+ write(*, fmt = '(25a)', advance = 'no') ' Hyperslab selection test'
+ write(*, fmt = '(46x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + hyperslab_total_error
- write(*, fmt = '23a', advance = 'no') ' Element selection test'
- write(*, fmt = '48x', advance = 'no')
error_string = failure
CALL test_select_element(element_total_error)
IF (element_total_error == 0) error_string = success
+ write(*, fmt = '(23a)', advance = 'no') ' Element selection test'
+ write(*, fmt = '(48x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + element_total_error
@@ -145,19 +145,19 @@
! write(*,*) 'Testing DATATYPE interface '
! write(*,*) '========================================='
- write(*, fmt = '20a', advance = 'no') ' Basic datatype test'
- write(*, fmt = '51x', advance = 'no')
error_string = failure
CALL basic_data_type_test(basic_datatype_total_error)
IF (basic_datatype_total_error == 0) error_string = success
+ write(*, fmt = '(20a)', advance = 'no') ' Basic datatype test'
+ write(*, fmt = '(51x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + basic_datatype_total_error
- write(*, fmt = '23a', advance = 'no') ' Compound datatype test'
- write(*, fmt = '48x', advance = 'no')
error_string = failure
CALL compoundtest(total_error_compoundtest)
IF (total_error_compoundtest == 0) error_string = success
+ write(*, fmt = '(23a)', advance = 'no') ' Compound datatype test'
+ write(*, fmt = '(48x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + total_error_compoundtest
@@ -166,11 +166,11 @@
! write(*,*) 'Testing PROPERTY interface '
! write(*,*) '========================================='
- write(*, fmt = '22a', advance = 'no') ' External dataset test'
- write(*, fmt = '49x', advance = 'no')
error_string = failure
CALL external_test(external_total_error)
IF (external_total_error == 0) error_string = success
+ write(*, fmt = '(22a)', advance = 'no') ' External dataset test'
+ write(*, fmt = '(49x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + external_total_error
@@ -179,10 +179,10 @@
! write(*,*) 'Testing ATTRIBUTE interface '
! write(*,*) '========================================='
- write(*, fmt = '15a', advance = 'no') ' Attribute test'
- write(*, fmt = '56x', advance = 'no')
error_string = failure
CALL attribute_test(attribute_total_error)
+ write(*, fmt = '(15a)', advance = 'no') ' Attribute test'
+ write(*, fmt = '(56x)', advance = 'no')
IF (attribute_total_error == 0) error_string = success
write(*, fmt = e_format) error_string
total_error = total_error + attribute_total_error
@@ -192,21 +192,21 @@
! write(*,*) 'Testing IDENTIFIER interface '
! write(*,*) '========================================='
- write(*, fmt = '16a', advance = 'no') ' Identifier test'
- write(*, fmt = '55x', advance = 'no')
error_string = failure
CALL identifier_test(identifier_total_error)
IF (identifier_total_error == 0) error_string = success
+ write(*, fmt = '(16a)', advance = 'no') ' Identifier test'
+ write(*, fmt = '(55x)', advance = 'no')
write(*, fmt = e_format) error_string
total_error = total_error + identifier_total_error
write(*,*)
- write(*,*) '============================================================================='
- write(*, fmt = "15x, 27a", advance='NO') ' FORTRAN tests completed with '
- write(*, fmt = "i4", advance='NO') total_error
- write(*, fmt = "12a" ) ' error(s) ! '
- write(*,*) '============================================================================='
+ write(*,*) ' ============================================ '
+ write(*, fmt = '(19x, 27a)', advance='NO') ' FORTRAN tests completed with '
+ write(*, fmt = '(i4)', advance='NO') total_error
+ write(*, fmt = '(12a)' ) ' error(s) ! '
+ write(*,*) ' ============================================ '
CALL h5close_types_f(error)
diff --git a/fortran/test/tH5A.f90 b/fortran/test/tH5A.f90
index 7bd61b4..a144317 100644
--- a/fortran/test/tH5A.f90
+++ b/fortran/test/tH5A.f90
@@ -14,7 +14,7 @@
CHARACTER(LEN=8), PARAMETER :: filename = "atest.h5" !File name
CHARACTER(LEN=9), PARAMETER :: dsetname = "atestdset" !Dataset name
CHARACTER(LEN=11), PARAMETER :: aname = "attr_string" !String Attribute name
- CHARACTER(LEN=13), PARAMETER :: aname2 = "attr_character"!Character Attribute name
+ CHARACTER(LEN=14), PARAMETER :: aname2 = "attr_character"!Character Attribute name
CHARACTER(LEN=11), PARAMETER :: aname3 = "attr_double" !DOuble Attribute name
CHARACTER(LEN=9), PARAMETER :: aname4 = "attr_real" !Real Attribute name
CHARACTER(LEN=12), PARAMETER :: aname5 = "attr_integer" !Integer Attribute name
@@ -61,16 +61,16 @@
INTEGER(HID_T) :: attr5_type !Returned INTEGER Attribute Datatype identifier
INTEGER :: num_attrs !number of attributes
CHARACTER*256 :: attr_name !buffer to put attr_name
- INTEGER :: name_size = 80 !attribute name length
+ INTEGER(SIZE_T) :: name_size = 80 !attribute name length
- CHARACTER*80, DIMENSION(2) :: attr_data ! Attribute data
+ CHARACTER*35, DIMENSION(2) :: attr_data ! String attribute data
+ CHARACTER*35, DIMENSION(2) :: aread_data ! Buffer to put read back
+ ! string attr data
CHARACTER :: attr_character_data = 'A'
DOUBLE PRECISION, DIMENSION(1) :: attr_double_data = 3.459
REAL, DIMENSION(1) :: attr_real_data = 4.0
INTEGER, DIMENSION(1) :: attr_integer_data = 5
- CHARACTER*80, DIMENSION(2) :: aread_data ! buffer to put read back
- !string attr data
CHARACTER :: aread_character_data ! variable to put read back Character attr data
INTEGER, DIMENSION(1) :: aread_integer_data ! variable to put read back integer attr data
@@ -105,9 +105,9 @@
!
! Initialize attribute's data
!
- attr_data(1) = "Dataset character attribute"
- attr_data(2) = "Some other string here "
- attrlen = 80
+ attr_data(1) = 'Dataset character attribute'
+ attr_data(2) = 'Some other string here '
+ attrlen = len(attr_data(1))
!
! Create the file.
@@ -270,7 +270,26 @@
CALL check("h5sclose_f",error,total_error)
CALL h5sclose_f(aspace2_id, error)
CALL check("h5sclose_f",error,total_error)
-
+ !
+ ! Terminate access to the dataset.
+ !
+ CALL h5dclose_f(dset_id, error)
+ CALL check("h5dclose_f",error,total_error)
+ !
+ ! Terminate access to the file.
+ !
+ CALL h5fclose_f(file_id, error)
+ CALL check("h5fclose_f",error,total_error)
+ !
+ ! Open file
+ !
+ CALL h5fopen_f(filename, H5F_ACC_RDWR_F, file_id, error)
+ CALL check("h5open_f",error,total_error)
+ !
+ ! Reopen dataset
+ !
+ CALL h5dopen_f(file_id, dsetname, dset_id, error)
+ CALL check("h5dopen_f",error,total_error)
!
!open the String attrbute by name
!
@@ -293,7 +312,10 @@
CALL h5aopen_name_f(dset_id, aname4, attr4_id, error)
CALL check("h5aopen_name_f",error,total_error)
- CALL h5aopen_idx_f(dset_id, 4, attr5_id, error)
+ !
+ !open the INTEGER attrbute by name
+ !
+ CALL h5aopen_name_f(dset_id, aname5, attr5_id, error)
CALL check("h5aopen_idx_f",error,total_error)
!
@@ -301,9 +323,10 @@
!
CALL h5aget_name_f(attr5_id, name_size, attr_name, error)
CALL check("h5aget_name_f",error,total_error)
-!Can I DO STRCMP LIKE THIS?
- if (attr_name(1:name_size) .ne. aname5) then
- write(*,*) "Get attr name is ", attr_name
+ if (attr_name(1:12) .ne. aname5) then
+ total_error = total_error + 1
+ end if
+ if (error .ne. 12) then
total_error = total_error + 1
end if