summaryrefslogtreecommitdiffstats
path: root/fortran/test
diff options
context:
space:
mode:
Diffstat (limited to 'fortran/test')
-rw-r--r--fortran/test/tH5A_1_8.f9051
-rw-r--r--fortran/test/tH5G_1_8.f9010
2 files changed, 44 insertions, 17 deletions
diff --git a/fortran/test/tH5A_1_8.f90 b/fortran/test/tH5A_1_8.f90
index f038fe7..e04504f 100644
--- a/fortran/test/tH5A_1_8.f90
+++ b/fortran/test/tH5A_1_8.f90
@@ -1020,10 +1020,8 @@ SUBROUTINE test_attr_info_by_idx(new_format, fcpl, fapl, total_error)
f_corder_valid, corder, cset, data_size, error, lapl_id=H5P_DEFAULT_F)
CALL VERIFY("h5aget_info_by_idx_f",error,minusone,total_error)
- size = 0
CALL h5aget_name_by_idx_f(my_dataset, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, &
-!EP 0_HSIZE_T, tmpname, size, error, lapl_id=H5P_DEFAULT_F)
- hzero, tmpname, size, error, lapl_id=H5P_DEFAULT_F)
+ hzero, tmpname, error, size, lapl_id=H5P_DEFAULT_F)
CALL VERIFY("h5aget_name_by_idx_f",error,minusone,total_error)
@@ -1210,17 +1208,50 @@ SUBROUTINE attr_info_by_idx_check(obj_id, attrname, n, use_index, total_error )
! /* Verify the name for new link, in increasing creation order */
-!!$ CALL HDmemset(tmpname, 0, (size_t))
+ ! Try with the correct buffer size
CALL h5aget_name_by_idx_f(obj_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, &
- n, tmpname, NAME_BUF_SIZE, error)
+ n, tmpname, error, NAME_BUF_SIZE)
CALL check("h5aget_name_by_idx_f",error,total_error)
+ CALL VERIFY("h5aget_name_by_idx_f", NAME_BUF_SIZE, 7, error)
- IF(TRIM(attrname).NE.TRIM(tmpname))THEN
+ IF(attrname.NE.tmpname)THEN
error = -1
ENDIF
CALL VERIFY("h5aget_name_by_idx_f",error,0,total_error)
-
+
+ ! Try with a larger buffer size then needed
+ NAME_BUF_SIZE = 17
+ CALL h5aget_name_by_idx_f(obj_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, &
+ n, tmpname, error, NAME_BUF_SIZE )
+ CALL check("h5aget_name_by_idx_f",error,total_error)
+ CALL VERIFY("h5aget_name_by_idx_f", NAME_BUF_SIZE, 7, error)
+
+ IF(attrname(1:NAME_BUF_SIZE).NE.tmpname(1:NAME_BUF_SIZE))THEN
+ error = -1
+ ENDIF
+ CALL VERIFY("h5aget_name_by_idx_f",error,0,total_error)
+
+ ! Try with a smaller buffer size then needed
+ NAME_BUF_SIZE = 5
+ CALL h5aget_name_by_idx_f(obj_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, &
+ n, tmpname, error, NAME_BUF_SIZE)
+ CALL check("h5aget_name_by_idx_f",error,total_error)
+ CALL VERIFY("h5aget_name_by_idx_f", NAME_BUF_SIZE, 7, error)
+
+ IF(attrname(1:5).NE.tmpname(1:5))THEN
+ error = -1
+ ENDIF
+ CALL VERIFY("h5aget_name_by_idx_f",error,0,total_error)
+
+ ! Try with a zero buffer size
+ NAME_BUF_SIZE = 0
+ CALL h5aget_name_by_idx_f(obj_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, &
+ n, tmpname, error, NAME_BUF_SIZE)
+ CALL check("h5aget_name_by_idx_f",error,total_error)
+ CALL VERIFY("h5aget_name_by_idx_f", NAME_BUF_SIZE, 7, error)
+
+
! /* Don't test "native" order if there is no creation order index, since
! * there's not a good way to easily predict the attribute's order in the name
! * index.
@@ -1244,7 +1275,7 @@ SUBROUTINE attr_info_by_idx_check(obj_id, attrname, n, use_index, total_error )
! /* Verify the name for new link, in increasing native order */
! CALL HDmemset(tmpname, 0, (size_t))
CALL h5aget_name_by_idx_f(obj_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_NATIVE_F, &
- n, tmpname, NAME_BUF_SIZE, error)
+ n, tmpname, error) ! check with no optional parameters
CALL check("h5aget_name_by_idx_f",error,total_error)
IF(TRIM(attrname).NE.TRIM(tmpname))THEN
WRITE(*,*) "ERROR: attribute name size wrong!"
@@ -2111,7 +2142,7 @@ SUBROUTINE test_attr_delete_by_idx(new_format, fcpl, fapl, total_error)
size = 7 ! *CHECK* IF NOT THE SAME SIZE
CALL h5aget_name_by_idx_f(my_dataset, ".", idx_type, order,INT(0,hsize_t), &
- tmpname, size, error, lapl_id=H5P_DEFAULT_F)
+ tmpname, error, lapl_id=H5P_DEFAULT_F, size=size)
CALL check('h5aget_name_by_idx_f',error,total_error)
IF(order .EQ. H5_ITER_INC_F)THEN
WRITE(chr2,'(I2.2)') u + 1
@@ -2251,7 +2282,7 @@ SUBROUTINE test_attr_delete_by_idx(new_format, fcpl, fapl, total_error)
size = 7 ! *CHECK* if not the correct size
CALL h5aget_name_by_idx_f(my_dataset, ".", idx_type, order,INT(0,hsize_t), &
- tmpname, size, error)
+ tmpname, error, size)
IF(order .EQ. H5_ITER_INC_F)THEN
WRITE(chr2,'(I2.2)') u + 1
diff --git a/fortran/test/tH5G_1_8.f90 b/fortran/test/tH5G_1_8.f90
index 092d90d..cc1ab67 100644
--- a/fortran/test/tH5G_1_8.f90
+++ b/fortran/test/tH5G_1_8.f90
@@ -2036,23 +2036,19 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, &
! The actual size of tmpname should be 7
- size_tmp = INT(3,SIZE_T)
- CALL H5Lget_name_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(n,HSIZE_T), size_tmp, tmpname_small, error)
+ CALL H5Lget_name_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(n,HSIZE_T), tmpname_small, error, size_tmp)
CALL check("link_info_by_idx_check.H5Lget_name_by_idx_f", error, total_error)
CALL verifyString("link_info_by_idx_check.H5Lget_name_by_idx_f", &
linkname(1:LEN(tmpname_small)), tmpname_small(1:LEN(tmpname_small)), total_error)
CALL VERIFY("link_info_by_idx_check.H5Lget_name_by_idx_f", INT(size_tmp), 7, total_error)
-
! try it with the correct size
- size_tmp = INT(LEN(tmpname),SIZE_T)
- CALL H5Lget_name_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(n,HSIZE_T), size_tmp, tmpname, error)
+ CALL H5Lget_name_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(n,HSIZE_T), tmpname, error, size=size_tmp)
CALL check("link_info_by_idx_check.H5Lget_name_by_idx_f", error, total_error)
CALL verifyString("link_info_by_idx_check.H5Lget_name_by_idx_f", &
linkname(1:LEN(tmpname)), tmpname(1:LEN(tmpname)), total_error)
CALL VERIFY("link_info_by_idx_check.H5Lget_name_by_idx_f", INT(size_tmp), 7, total_error)
- size_tmp = INT(LEN(tmpname_big),SIZE_T)
- CALL H5Lget_name_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(n,HSIZE_T), size_tmp, tmpname_big, error)
+ CALL H5Lget_name_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(n,HSIZE_T), tmpname_big, error, size_tmp)
CALL check("link_info_by_idx_check.H5Lget_name_by_idx_f", error, total_error)
CALL verifyString("link_info_by_idx_check.H5Lget_name_by_idx_f", &
linkname(1:7), tmpname_big(1:7), total_error)