summaryrefslogtreecommitdiffstats
path: root/tools/h5dump/h5dumpgentest.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2007-02-12 21:32:36 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2007-02-12 21:32:36 (GMT)
commitc8fb91983eef3191d859e76e66224eff5c2f40ad (patch)
tree4705b6009821b83068b11d8056b5044a7ad46fa2 /tools/h5dump/h5dumpgentest.c
parent0f83bd0964b7a6395e51bb1d03216049df49c57d (diff)
downloadhdf5-c8fb91983eef3191d859e76e66224eff5c2f40ad.zip
hdf5-c8fb91983eef3191d859e76e66224eff5c2f40ad.tar.gz
hdf5-c8fb91983eef3191d859e76e66224eff5c2f40ad.tar.bz2
[svn-r13283]
added a test for the printing of long long numbers greater than 4GB
Diffstat (limited to 'tools/h5dump/h5dumpgentest.c')
-rw-r--r--tools/h5dump/h5dumpgentest.c69
1 files changed, 67 insertions, 2 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 2a955b4..93bb456 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -84,7 +84,8 @@
#define FILE54 "tudlink.h5"
#define FILE55 "tbinary.h5"
#define FILE56 "tbigdims.h5"
-#define FILE57 "thyperslab.h5"
+#define FILE57 "tbigdata.h5"
+#define FILE58 "thyperslab.h5"
/*-------------------------------------------------------------------------
* prototypes
@@ -5727,6 +5728,69 @@ out:
return;
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gen_bigdata
+ *
+ * Purpose: generate a dataset with integer numbers greater than 4GB
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void gen_bigdata(void)
+{
+ hid_t fid;
+ hid_t did;
+ hid_t f_sid;
+ hsize_t dims[1]={10}; /* dataset dimensions */
+ long_long buf[10];
+ hsize_t i;
+ size_t nelmts=10;
+ int ret;
+
+ /* create a file */
+ fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ assert(fid>=0);
+
+ if ((f_sid = H5Screate_simple(1,dims,NULL))<0)
+ goto out;
+ if ((did = H5Dcreate(fid,"dsetlonglong",H5T_NATIVE_LLONG,f_sid,H5P_DEFAULT))<0)
+ goto out;
+
+ buf[0] = GB4LL - 2;
+
+ for (i=1; i<nelmts; i++)
+ {
+ buf[i] = buf[i-1] + 1;
+ }
+
+ if (H5Dwrite (did,H5T_NATIVE_LLONG,H5S_ALL,f_sid,H5P_DEFAULT,buf)<0)
+ goto out;
+
+ /* close */
+ if(H5Sclose(f_sid)<0)
+ goto out;
+ if(H5Dclose(did)<0)
+ goto out;
+
+ ret=H5Fclose(fid);
+ assert(ret>=0);
+
+ return;
+
+out:
+ printf("Error.....\n");
+ H5E_BEGIN_TRY {
+ H5Sclose(f_sid);
+ H5Dclose(did);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return;
+
+}
+
+
/*-------------------------------------------------------------------------
* Function: gent_hyperslab
*
@@ -5746,7 +5810,7 @@ static void gent_hyperslab(void)
buf[i] = 1;
/* create a file */
- fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE58, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
assert(fid>=0);
write_dset(fid,2,dims,"stripmine",H5T_NATIVE_DOUBLE,buf);
@@ -5822,6 +5886,7 @@ int main(void)
gent_ldouble();
gent_binary();
gent_bigdims();
+ gen_bigdata();
gent_hyperslab();
return 0;