summaryrefslogtreecommitdiffstats
path: root/test/tgenprop.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-10-07 17:55:55 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-10-07 17:55:55 (GMT)
commitf2d67b4864424bc52e876f709304604352055cd3 (patch)
tree43fe876dc3347387a74cfaf53ec241f15d36bf48 /test/tgenprop.c
parent0a8533efe1b5bbbaa1012d4b3123f94430f8f626 (diff)
downloadhdf5-f2d67b4864424bc52e876f709304604352055cd3.zip
hdf5-f2d67b4864424bc52e876f709304604352055cd3.tar.gz
hdf5-f2d67b4864424bc52e876f709304604352055cd3.tar.bz2
[svn-r5962] Purpose:
Bug fix Description: H5Pequal's algorithm for comparing property lists wasn't allowing property lists that are equal but had the properties inserted in a different order in the list's hash table. Solution: Re-did the algorithm a bit to compare the properties better. Platforms tested: FreeBSD 4.6 (sleipnir) (minor enough to not need triple testing)
Diffstat (limited to 'test/tgenprop.c')
-rw-r--r--test/tgenprop.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/tgenprop.c b/test/tgenprop.c
index 4f97322..93cc3ff 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -519,6 +519,10 @@ test_genprop_basic_list(void)
cid1 = H5Pcreate_class(H5P_NO_CLASS,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL,NULL,NULL);
CHECK_I(cid1, "H5Pcreate_class");
+ /* Create a the generic class again, should fail */
+ cid2 = H5Pcreate_class(H5P_NO_CLASS,CLASS1_NAME,CLASS1_HASHSIZE,NULL,NULL,NULL,NULL,NULL,NULL);
+ VERIFY(cid2, FAIL, "H5Pcreate_class");
+
/* Add several properties (w/default values) */
/* Insert first property into class (with no callbacks) */
@@ -1367,6 +1371,54 @@ test_genprop_class_addprop(void)
/****************************************************************
**
+** test_genprop_list_equal(): Test basic generic property list code.
+** More tests for H5Pequal()
+**
+****************************************************************/
+static void
+test_genprop_equal(void)
+{
+ hid_t cid1; /* Generic Property class ID */
+ hid_t lid1; /* Generic Property list ID */
+ hid_t lid2; /* Generic Property list ID */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Basic Generic Property List Equal Functionality\n"));
+
+ /* Create a new generic class, derived from the root of the class hierarchy */
+ /* (Use a hash size of 1 to force the properties into the same hash chain) */
+ cid1 = H5Pcreate_class(H5P_NO_CLASS,CLASS1_NAME,1,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");
+
+ /* Insert second property into class (with no callbacks) */
+ ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
+ CHECK_I(ret, "H5Pregister");
+
+ /* Create a property list from the class */
+ lid1 = H5Pcreate(cid1);
+ CHECK_I(lid1, "H5Pcreate");
+
+ /* Copy the property list */
+ lid2 = H5Pcopy(lid1);
+ CHECK_I(lid2, "H5Pcopy");
+
+ /* Check that the lists are equal */
+ ret = H5Pequal(lid1,lid2);
+ VERIFY(ret, 1, "H5Pequal");
+
+ /* Close class */
+ ret = H5Pclose_class(cid1);
+ CHECK_I(ret, "H5Pclose_class");
+
+} /* ent test_genprop_equal() */
+
+/****************************************************************
+**
** test_genprop(): Main generic property testing routine.
**
****************************************************************/
@@ -1390,6 +1442,8 @@ test_genprop(void)
test_genprop_list_addprop(); /* Test adding properties to HDF5 property list */
test_genprop_class_addprop(); /* Test adding properties to HDF5 property class */
+ test_genprop_equal(); /* Tests for more H5Pequal verification */
+
} /* test_genprop() */