summaryrefslogtreecommitdiffstats
path: root/test/tattr.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-09-27 23:09:59 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-09-27 23:09:59 (GMT)
commit5b1a07823fc61017b85a1503ae5453e18716708e (patch)
tree4b3c6c37928eeb6cf150c2e80b041ff613e94dc8 /test/tattr.c
parentc63f9b42ec89ff649f4f086e2f422fa01d9967b1 (diff)
downloadhdf5-5b1a07823fc61017b85a1503ae5453e18716708e.zip
hdf5-5b1a07823fc61017b85a1503ae5453e18716708e.tar.gz
hdf5-5b1a07823fc61017b85a1503ae5453e18716708e.tar.bz2
[svn-r14163] Description:
Make H5Arename() versioned and switch internal usage to use H5Arename2() Add regression test for H5Arename1() Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode AIX/32 5.3 (copper) w/FORTRAN, w/parallel, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'test/tattr.c')
-rw-r--r--test/tattr.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/test/tattr.c b/test/tattr.c
index 2c57d49..8a07cae 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -236,51 +236,51 @@ test_attr_basic_write(hid_t fapl)
CHECK(ret, FAIL, "H5Awrite");
/* Check storage size for attribute */
- attr_size=H5Aget_storage_size(attr);
- VERIFY(attr_size, (ATTR1_DIM1*sizeof(int)), "H5A_get_storage_size");
+ attr_size = H5Aget_storage_size(attr);
+ VERIFY(attr_size, (ATTR1_DIM1 * sizeof(int)), "H5A_get_storage_size");
/* Read attribute information immediately, without closing attribute */
- ret=H5Aread(attr,H5T_NATIVE_INT,read_data1);
+ ret = H5Aread(attr, H5T_NATIVE_INT, read_data1);
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ for(i = 0; i < ATTR1_DIM1; i++)
+ if(attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]);
/* Close attribute */
- ret=H5Aclose(attr);
+ ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Close attribute */
- ret=H5Aclose(attr2);
+ ret = H5Aclose(attr2);
CHECK(ret, FAIL, "H5Aclose");
/* change attribute name */
- ret=H5Arename(dataset, ATTR1_NAME, ATTR_TMP_NAME);
- CHECK(ret, FAIL, "H5Arename");
+ ret = H5Arename2(dataset, ".", ATTR1_NAME, ATTR_TMP_NAME, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Arename2");
/* Open attribute again */
- attr=H5Aopen_name(dataset, ATTR_TMP_NAME);
+ attr = H5Aopen_name(dataset, ATTR_TMP_NAME);
CHECK(attr, FAIL, "H5Aopen_name");
/* Verify new attribute name */
attr_name_size = H5Aget_name(attr, (size_t)0, NULL);
CHECK(attr_name_size, FAIL, "H5Aget_name");
- if(attr_name_size>0)
- attr_name = (char*)HDcalloc((size_t)(attr_name_size+1), sizeof(char));
+ if(attr_name_size > 0)
+ attr_name = (char*)HDcalloc((size_t)(attr_name_size + 1), sizeof(char));
- ret=(herr_t)H5Aget_name(attr, (size_t)(attr_name_size+1), attr_name);
+ ret = (herr_t)H5Aget_name(attr, (size_t)(attr_name_size + 1), attr_name);
CHECK(ret, FAIL, "H5Aget_name");
- ret=HDstrcmp(attr_name, ATTR_TMP_NAME);
+ ret = HDstrcmp(attr_name, ATTR_TMP_NAME);
VERIFY(ret, 0, "HDstrcmp");
if(attr_name)
HDfree(attr_name);
/* Read attribute information immediately, without closing attribute */
- ret=H5Aread(attr,H5T_NATIVE_INT,read_data1);
+ ret = H5Aread(attr, H5T_NATIVE_INT, read_data1);
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
@@ -3273,7 +3273,7 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
- /* Re-open the file and delete the attribute */
+ /* Re-open the file and operate on the attribute */
/* Re-open file */
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
@@ -3284,8 +3284,12 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen");
+ /* Rename attribute */
+ ret = H5Arename1(dataset, "attr", "attr2");
+ CHECK(ret, FAIL, "H5Arename1");
+
/* Delete attribute */
- ret = H5Adelete1(dataset, "attr");
+ ret = H5Adelete1(dataset, "attr2");
CHECK(ret, FAIL, "H5Adelete1");