summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-01-27 20:39:20 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-01-27 20:39:20 (GMT)
commit61a451f89ea2015eac08e361e6ad244bd4af5f25 (patch)
tree0f2dccdca39001329f6004a149e8384fa4e4433f /test
parent6042adf10b2c00796c52dec2a1f97a4989c42cfd (diff)
downloadhdf5-61a451f89ea2015eac08e361e6ad244bd4af5f25.zip
hdf5-61a451f89ea2015eac08e361e6ad244bd4af5f25.tar.gz
hdf5-61a451f89ea2015eac08e361e6ad244bd4af5f25.tar.bz2
[svn-r8117] Purpose:
Code cleanup Description: Add C++ and FORTRAN wrappers for new H5Pdelete_filter routine, along with documentation and a note in the release notes. Platforms tested: FreeBSD 4.9 (sleipnir) Linux 2.4 (verbena) w/ C++ and FORTRAN Too minor for full h5committest
Diffstat (limited to 'test')
-rw-r--r--test/dsets.c164
1 files changed, 84 insertions, 80 deletions
diff --git a/test/dsets.c b/test/dsets.c
index 5121234..e189f9b 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -3074,8 +3074,7 @@ error:
return -1;
} /* end test_compare_dcpl() */
-
-
+
/*-------------------------------------------------------------------------
* Function: test_filter_delete
*
@@ -3094,105 +3093,110 @@ error:
static herr_t
test_filter_delete(hid_t file)
{
- H5Z_filter_t filtn; /* filter identification number */
- hid_t dsid; /* dataset ID */
- hid_t sid; /* dataspace ID */
- hid_t dcpl; /* dataset creation property list ID */
- hid_t dcpl1; /* dataset creation property list ID */
- hsize_t dims[2] = {20,20}; /* dataspace dimensions */
- hsize_t chunk_dims[2] = {10,10}; /* chunk dimensions */
- size_t nfilters; /* number of filters in DCPL */
- size_t i;
-
- TESTING("filter deletion");
-
- /* Create the data space */
- if ((sid = H5Screate_simple(2, dims, NULL))<0) goto error;
-
- /* Create dcpl */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
- if(H5Pset_chunk(dcpl, 2, chunk_dims)<0) goto error;
+ H5Z_filter_t filtn; /* filter identification number */
+ hid_t dsid; /* dataset ID */
+ hid_t sid; /* dataspace ID */
+ hid_t dcpl; /* dataset creation property list ID */
+ hid_t dcpl1; /* dataset creation property list ID */
+ hsize_t dims[2] = {20,20}; /* dataspace dimensions */
+ hsize_t chunk_dims[2] = {10,10}; /* chunk dimensions */
+ size_t nfilters; /* number of filters in DCPL */
+ size_t i;
+ herr_t ret; /* Generic return value */
+
+ TESTING("filter deletion");
+
+ /* Create the data space */
+ if ((sid = H5Screate_simple(2, dims, NULL))<0) goto error;
+
+ /* Create dcpl */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
+ if(H5Pset_chunk(dcpl, 2, chunk_dims)<0) goto error;
#if defined H5_HAVE_FILTER_FLETCHER32
- if (H5Pset_fletcher32 (dcpl)<0) goto error;
+ if (H5Pset_fletcher32 (dcpl)<0) goto error;
#endif
#if defined H5_HAVE_FILTER_DEFLATE
- if (H5Pset_deflate (dcpl, 6)<0) goto error;
+ if (H5Pset_deflate (dcpl, 6)<0) goto error;
#endif
#if defined H5_HAVE_FILTER_SHUFFLE
- if (H5Pset_shuffle (dcpl)<0) goto error;
+ if (H5Pset_shuffle (dcpl)<0) goto error;
#endif
- /* Create a dataset */
- if ((dsid = H5Dcreate(file,"dsetdel", H5T_NATIVE_INT, sid, dcpl)) <0) goto error;
+ /* Create a dataset */
+ if ((dsid = H5Dcreate(file,"dsetdel", H5T_NATIVE_INT, sid, dcpl)) <0) goto error;
- /* Get copy of dataset's dataset creation property list */
- if ((dcpl1=H5Dget_create_plist(dsid))<0) goto error;
-
-/*----------------------------------------------------------------------
- * delete the deflate filter
- *----------------------------------------------------------------------
- */
+ /* Get copy of dataset's dataset creation property list */
+ if ((dcpl1=H5Dget_create_plist(dsid))<0) goto error;
+ /*----------------------------------------------------------------------
+ * delete the deflate filter
+ *----------------------------------------------------------------------
+ */
#if defined H5_HAVE_FILTER_DEFLATE
-
- /* delete the deflate filter */
- if (H5Pdelete_filter(dcpl1,H5Z_FILTER_DEFLATE)<0) goto error;
-
- /* get information about filters */
- if ((nfilters = H5Pget_nfilters(dcpl1))<0) goto error;
+ /* delete the deflate filter */
+ if (H5Pdelete_filter(dcpl1,H5Z_FILTER_DEFLATE)<0) goto error;
- /* check if filter was deleted */
- for (i=0; i<nfilters; i++)
- {
- filtn = H5Pget_filter(dcpl1,i,0,0,0,0,0);
- if (H5Z_FILTER_DEFLATE==filtn)
- goto error;
- }
+ /* get information about filters */
+ if ((nfilters = H5Pget_nfilters(dcpl1))<0) goto error;
+
+ /* check if filter was deleted */
+ for (i=0; i<nfilters; i++) {
+ filtn = H5Pget_filter(dcpl1,i,0,0,0,0,0);
+ if (H5Z_FILTER_DEFLATE==filtn)
+ goto error;
+ }
+
+ /* Try to delete the deflate filter again */
+ H5E_BEGIN_TRY {
+ ret=H5Pdelete_filter(dcpl1,H5Z_FILTER_DEFLATE);
+ } H5E_END_TRY;
+ if (ret >=0) {
+ H5_FAILED();
+ printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__);
+ goto error;
+ } /* end if */
#endif /*H5_HAVE_FILTER_DEFLATE*/
-
-/*----------------------------------------------------------------------
- * delete all filters
- *----------------------------------------------------------------------
- */
- /* delete all filters */
- if (H5Pdelete_filter(dcpl1,H5Z_FILTER_NONE)<0) goto error;
- /* get information about filters */
- if ((nfilters = H5Pget_nfilters(dcpl1))<0) goto error;
+ /*----------------------------------------------------------------------
+ * delete all filters
+ *----------------------------------------------------------------------
+ */
+ /* delete all filters */
+ if (H5Pdelete_filter(dcpl1,H5Z_FILTER_NONE)<0) goto error;
- /* check if filters were deleted */
- if (nfilters)goto error;
-
-/*----------------------------------------------------------------------
- * close
- *----------------------------------------------------------------------
- */
-
- /* clean up objects used for this test */
- if (H5Pclose (dcpl)<0) goto error;
- if (H5Pclose (dcpl1)<0) goto error;
- if (H5Dclose (dsid)<0) goto error;
- if (H5Sclose (sid)<0) goto error;
-
- PASSED();
- return 0;
-
-error:
- H5E_BEGIN_TRY {
- H5Pclose(dcpl);
- H5Pclose(dcpl1);
- H5Dclose(dsid);
- H5Sclose(sid);
- } H5E_END_TRY;
- return -1;
-}
+ /* get information about filters */
+ if ((nfilters = H5Pget_nfilters(dcpl1))<0) goto error;
+
+ /* check if filters were deleted */
+ if (nfilters)goto error;
+ /*----------------------------------------------------------------------
+ * close
+ *----------------------------------------------------------------------
+ */
+ /* clean up objects used for this test */
+ if (H5Pclose (dcpl)<0) goto error;
+ if (H5Pclose (dcpl1)<0) goto error;
+ if (H5Dclose (dsid)<0) goto error;
+ if (H5Sclose (sid)<0) goto error;
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Pclose(dcpl1);
+ H5Dclose(dsid);
+ H5Sclose(sid);
+ } H5E_END_TRY;
+ return -1;
+} /* end test_filter_delete() */
/*-------------------------------------------------------------------------