summaryrefslogtreecommitdiffstats
path: root/test/tgenprop.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-10-14 19:59:00 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-10-14 19:59:00 (GMT)
commit92cfe70bb653ff2e5fca1063723749aa6f8bdaf5 (patch)
treea5b31bf45f79f08fc69aa2d901e714f9813895b4 /test/tgenprop.c
parent0173a3720d0576dfdf4053ae7c8c406d930e0857 (diff)
downloadhdf5-92cfe70bb653ff2e5fca1063723749aa6f8bdaf5.zip
hdf5-92cfe70bb653ff2e5fca1063723749aa6f8bdaf5.tar.gz
hdf5-92cfe70bb653ff2e5fca1063723749aa6f8bdaf5.tar.bz2
[svn-r5994] Purpose:
New test Description: Add test to check for correct generic property class reference counting. Platforms tested: FreeBSD 4.6 (sleipnir) w and w/o parallel Linux 2.2.x (eirene) w/FORTRAN & C++ Solaris 2.7 (arabica) w/FORTRAN IRIX64 6.5 (modi4) w/FORTRAN & parallel
Diffstat (limited to 'test/tgenprop.c')
-rw-r--r--test/tgenprop.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/test/tgenprop.c b/test/tgenprop.c
index bddbec9..4ea91e4 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -1497,6 +1497,84 @@ test_genprop_path(void)
/****************************************************************
**
+** test_genprop_refcount(): Test basic generic property list code.
+** Tests for correct reference counting
+**
+****************************************************************/
+static void
+test_genprop_refcount(void)
+{
+ hid_t cid1; /* Generic Property class ID */
+ hid_t lid1; /* Generic Property class ID */
+ char *name; /* Name of class */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Generic Property List Reference Count Functionality\n"));
+
+ /* Create a new generic class, derived from the root of the class hierarchy */
+ cid1 = H5Pcreate_class(H5P_NO_CLASS,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL,NULL,NULL);
+ CHECK_I(cid1, "H5Pcreate_class");
+
+ /* Insert first property into class (with no callbacks) */
+ ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
+ CHECK_I(ret, "H5Pregister");
+
+ /* Create a new generic list, derived from the root of the class hierarchy */
+ lid1 = H5Pcreate(cid1);
+ CHECK_I(lid1, "H5Pcreate");
+
+ /* Check class name */
+ name = H5Pget_class_name(cid1);
+ CHECK_PTR(name, "H5Pget_class_name");
+ if(HDstrcmp(name,CLASS1_NAME)!=0) {
+ num_errs++;
+ printf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
+ } /* end if */
+ free(name);
+
+ /* Close class */
+ ret = H5Pclose_class(cid1);
+ CHECK_I(ret, "H5Pclose_class");
+
+ /* Get the list's class */
+ cid1 = H5Pget_class(lid1);
+ CHECK_I(cid1, "H5Pget_class");
+
+ /* Check correct "is a" class/list relationship */
+ ret = H5Pisa_class(lid1,cid1);
+ VERIFY(ret, 1, "H5Pisa_class");
+
+ /* Check class name */
+ name = H5Pget_class_name(cid1);
+ CHECK_PTR(name, "H5Pget_class_name");
+ if(HDstrcmp(name,CLASS1_NAME)!=0) {
+ num_errs++;
+ printf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
+ } /* end if */
+ free(name);
+
+ /* Close list */
+ ret = H5Pclose(lid1);
+ CHECK_I(ret, "H5Pclose");
+
+ /* Check class name */
+ name = H5Pget_class_name(cid1);
+ CHECK_PTR(name, "H5Pget_class_name");
+ if(HDstrcmp(name,CLASS1_NAME)!=0) {
+ num_errs++;
+ printf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
+ } /* end if */
+ free(name);
+
+ /* Close class */
+ ret = H5Pclose_class(cid1);
+ CHECK_I(ret, "H5Pclose_class");
+
+} /* ent test_genprop_refcount() */
+
+/****************************************************************
+**
** test_genprop(): Main generic property testing routine.
**
****************************************************************/
@@ -1522,6 +1600,7 @@ test_genprop(void)
test_genprop_equal(); /* Tests for more H5Pequal verification */
test_genprop_path(); /* Tests for class path verification */
+ test_genprop_refcount(); /* Tests for class reference counting */
} /* test_genprop() */