summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
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
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')
-rw-r--r--tools/h5dump/CMakeLists.txt9
-rw-r--r--tools/h5dump/h5dumpgentest.c41
-rw-r--r--tools/h5dump/testh5dump.sh.in3
3 files changed, 53 insertions, 0 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index 05688ec..2010b5c 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -115,6 +115,7 @@ IF (BUILD_TESTING)
tnbit.ddl
tnofilename.ddl
tnullspace.ddl
+ zerodim.ddl
tordergr1.ddl
tordergr2.ddl
tordergr3.ddl
@@ -287,6 +288,7 @@ IF (BUILD_TESTING)
tnamed_dtype_attr.h5
tnestedcomp.h5
tnullspace.h5
+ zerodim.h5
torderattr.h5
tordergr.h5
tsaf.h5
@@ -785,6 +787,8 @@ IF (BUILD_TESTING)
tnofilename.out.err
tnullspace.out
tnullspace.out.err
+ zerodim.out
+ zerodim.out.err
tordergr1.out
tordergr1.out.err
tordergr2.out
@@ -1097,6 +1101,9 @@ IF (BUILD_TESTING)
# test for displaying dataset and attribute of null space
ADD_H5_TEST (tnullspace 0 tnullspace.h5)
+ # test for displaying dataset and attribute of space with 0 dimension size
+ ADD_H5_TEST (zerodim 0 zerodim.h5)
+
# test for long double (some systems do not have long double)
#ADD_H5_TEST (tldouble 0 tldouble.h5)
@@ -1582,6 +1589,8 @@ IF (BUILD_TESTING)
##Test dataset and attribute of null space. Commented out:
## wait until the XML schema is updated for null space.
## ADD_XML_H5_TEST (tnullspace.h5 0 tnulspace.h5)
+ ## So is dataspace with 0 dimension size.
+ ## ADD_XML_H5_TEST (zerodim.h5 0 zerodim.h5)
# other options for xml
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();
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 581d19a..e50055a 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -568,6 +568,9 @@ TOOLTEST thyperslab.ddl thyperslab.h5
# test for displaying dataset and attribute of null space
TOOLTEST tnullspace.ddl tnullspace.h5
+# test for displaying dataset and attribute of space with 0 dimension size
+TOOLTEST zerodim.ddl zerodim.h5
+
# test for long double (some systems do not have long double)
#TOOLTEST tldouble.ddl tldouble.h5