summaryrefslogtreecommitdiffstats
path: root/test
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
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')
-rw-r--r--test/Makefile.in2
-rw-r--r--test/tfile.c22
2 files changed, 22 insertions, 2 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
index 022c58c..823c088 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -54,7 +54,7 @@ PUB_LIB=
## prefix or low-level driver with environment variables will influence
## the temporary file name in ways that the makefile is not aware of.
MOSTLYCLEAN=cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h5 \
- tfile1.h5 tfile2.h5 tfile3.h5 th5s1.h5 lheap.h5 ohdr.h5 stab1.h5 \
+ tfile[1-4].h5 th5s1.h5 lheap.h5 ohdr.h5 stab1.h5 \
stab2.h5 extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 \
links.h5 links[1-3].h5 big.data big[0-9][0-9][0-9][0-9][0-9].h5 \
dtypes[1-3].h5 tattr.h5 tselect.h5 mtime.h5 unlink.h5 \
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");