summaryrefslogtreecommitdiffstats
path: root/test/getname.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/getname.c')
-rw-r--r--test/getname.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/getname.c b/test/getname.c
index fbad220..31440d6 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -2524,6 +2524,14 @@ test_obj_ref(hid_t fapl)
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR
*buf = '\0';
+
+ /* Check H5Rget_name returns the correct length of the name when name is NULL */
+ i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 0);
+ if(i != 9) TEST_ERROR
+ /* Make sure size parameter is ignored */
+ i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 200);
+ if(i != 9) TEST_ERROR
+
i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf));
if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR
PASSED()
@@ -2761,7 +2769,12 @@ test_reg_ref(hid_t fapl)
/* Get name of the dataset the first region reference points to using H5Rget_name */
TESTING("H5Rget_name to get name from region reference(hyperslab)");
*buf1 = '\0';
- name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char*)buf1, NAME_BUF_SIZE);
+
+ /* Check H5Rget_name returns the correct length of the name when name is NULL */
+ name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], NULL, 0);
+ if(name_size1 != 7) TEST_ERROR
+
+ name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char*)buf1, NAME_BUF_SIZE );
if(!((HDstrcmp(buf1, "/MATRIX") == 0) &&(name_size1 == 7))) TEST_ERROR
PASSED()