summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2011-04-20 20:51:22 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2011-04-20 20:51:22 (GMT)
commit614e46f270a2acc01a9d15c456420320f207086b (patch)
tree284b19d2abb4231f366169835d2965a653de7f93 /tools/h5dump
parent27be7d1e2d95618c72bbefbed54e644b3b2d21ae (diff)
downloadhdf5-614e46f270a2acc01a9d15c456420320f207086b.zip
hdf5-614e46f270a2acc01a9d15c456420320f207086b.tar.gz
hdf5-614e46f270a2acc01a9d15c456420320f207086b.tar.bz2
[svn-r20577] 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, linew, and amani. Tested CMAKE on jam.
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 b732bfe..30b40da 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
@@ -711,6 +713,8 @@ IF (BUILD_TESTING)
tnofilename.out.err
tnullspace.out
tnullspace.out.err
+ zerodim.out
+ zerodim.out.err
tordergr1.out
tordergr1.out.err
tordergr2.out
@@ -1021,6 +1025,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)
@@ -1327,6 +1334,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 ebdff41..d2af91c 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -96,6 +96,7 @@
#define FILE64 "tattrreg.h5"
#define FILE65 "file_space.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
@@ -5103,7 +5109,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
@@ -7144,6 +7184,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 512238d..9b56f7c 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -562,6 +562,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