summaryrefslogtreecommitdiffstats
path: root/tools/h5dump/h5dumpgentest.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2011-04-20 21:34:49 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2011-04-20 21:34:49 (GMT)
commit4d0fbe96bc085d53f9964a4801bdb89d69edfed5 (patch)
treed6c227567ba7df7042f6e8bd36160e202757a820 /tools/h5dump/h5dumpgentest.c
parent73fde75a6c78ff075b610c407a0dd61bc6a24c30 (diff)
downloadhdf5-4d0fbe96bc085d53f9964a4801bdb89d69edfed5.zip
hdf5-4d0fbe96bc085d53f9964a4801bdb89d69edfed5.tar.gz
hdf5-4d0fbe96bc085d53f9964a4801bdb89d69edfed5.tar.bz2
[svn-r20579] Bug 1386 - allowing dimension size to be zero. I added test cases in the tests for h5dump and h5diff. I also added the
test cases in the CMAKE script. Tested on jam. But I tested the same change in the trunk with h5committest.
Diffstat (limited to 'tools/h5dump/h5dumpgentest.c')
-rw-r--r--tools/h5dump/h5dumpgentest.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 848006e..452441a 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -96,6 +96,7 @@
#define FILE64 "tarray8.h5"
#define FILE65 "tattrreg.h5"
#define FILE66 "packedbits.h5"
+#define FILE67 "zerodim.h5"
@@ -177,6 +178,11 @@ const H5L_class_t UD_link_class[1] = {{
#define CDIM2 DIM2/2
#define RANK 2
+/* Dataspace of 0 dimension size */
+#define SPACE3_RANK 2
+#define SPACE3_DIM1 0
+#define SPACE3_DIM2 0
+
/* Element selection information */
#define POINT1_NPOINTS 10
@@ -5094,7 +5100,41 @@ static void gent_null_space(void)
H5Fclose(fid);
}
+/*-------------------------------------------------------------------------
+ * Function: gent_zero_dim_size
+ *
+ * Purpose: generates dataset and attribute with dataspace of 0 dimension size
+ *-------------------------------------------------------------------------
+ */
+static void gent_zero_dim_size(void)
+{
+ hid_t fid, root, dataset, space, attr;
+ hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2};
+ int dset_buf = 10;
+ int point = 4;
+
+ fid = H5Fcreate(FILE67, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ root = H5Gopen2(fid, "/", H5P_DEFAULT);
+
+ /* dataspace of 0 dimension size */
+ space = H5Screate_simple(SPACE3_RANK, dims1, NULL);
+ /* dataset */
+ dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT);
+ /* nothing should be written */
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf);
+
+ /* attribute */
+ attr = H5Acreate2(root, "attr of 0 dimension size", H5T_NATIVE_UINT, space, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(attr, H5T_NATIVE_INT, &point); /* Nothing can be written */
+
+ H5Dclose(dataset);
+ H5Aclose(attr);
+ H5Gclose(root);
+ H5Sclose(space);
+ H5Fclose(fid);
+}
/*-------------------------------------------------------------------------
* Function: make_dset
@@ -7109,6 +7149,7 @@ int main(void)
gent_compound_complex();
gent_named_dtype_attr();
gent_null_space();
+ gent_zero_dim_size();
gent_filters();
gent_fvalues();