summaryrefslogtreecommitdiffstats
path: root/test/tfile.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-10-29 18:27:37 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-10-29 18:27:37 (GMT)
commitbbe23c026f974be06e2aa86cff55cd255b33e2d0 (patch)
treeed03d4462f7477ce9b3710f8fcda146c17c561b1 /test/tfile.c
parent8b45b9a5f0305b6f881f25a8a7649fb67decca0f (diff)
downloadhdf5-bbe23c026f974be06e2aa86cff55cd255b33e2d0.zip
hdf5-bbe23c026f974be06e2aa86cff55cd255b33e2d0.tar.gz
hdf5-bbe23c026f974be06e2aa86cff55cd255b33e2d0.tar.bz2
[svn-r7786] Purpose:
Code cleanup & add a feature Description: Added support for querying the file ID of named datatypes to new H5Iget_file_id function. Platforms tested: FreeBSD 4.9 (sleipnir) too minor to require h5committest
Diffstat (limited to 'test/tfile.c')
-rw-r--r--test/tfile.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/tfile.c b/test/tfile.c
index 91ecf18..a5ec702 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -54,6 +54,7 @@
#define FILE3 "tfile3.h5"
#define ATTR_NAME "attr"
+#define TYPE_NAME "type"
#define FILE4 "tfile4.h5"
#define OBJ_ID_COUNT_0 0
@@ -827,7 +828,7 @@ static void
test_get_file_id(void)
{
hid_t fid1, fid2;
- hid_t dataset_id, dataspace_id, group_id, attr_id;
+ hid_t datatype_id, dataset_id, dataspace_id, group_id, attr_id;
hid_t plist;
hsize_t dims[F2_RANK];
herr_t ret;
@@ -891,6 +892,22 @@ test_get_file_id(void)
ret = H5Fclose(fid2);
CHECK(ret, FAIL, "H5Fclose");
+ /* Create a named datatype. Make a duplicated file ID from
+ * this attribute. And close it.
+ */
+ datatype_id=H5Tcopy(H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Acreate");
+
+ ret = H5Tcommit(fid1, TYPE_NAME, datatype_id);
+ CHECK(ret, FAIL, "H5Tcommit");
+
+ fid2 = H5Iget_file_id(datatype_id);
+ CHECK(fid2, FAIL, "H5Iget_file_id");
+ VERIFY(fid2, fid1, "H5Iget_file_id");
+
+ ret = H5Fclose(fid2);
+ CHECK(ret, FAIL, "H5Fclose");
+
/* Create a property list and try to get file ID from it.
* Supposed to fail.
*/
@@ -903,6 +920,9 @@ test_get_file_id(void)
VERIFY(fid2, FAIL, "H5Iget_file_id");
/* Close objects */
+ ret = H5Tclose(datatype_id);
+ CHECK(ret, FAIL, "H5Tclose");
+
ret = H5Aclose(attr_id);
CHECK(ret, FAIL, "H5Aclose");