summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2006-10-03 16:33:55 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2006-10-03 16:33:55 (GMT)
commite23d2acad826dd7a4155b835872f029d0fcbe09f (patch)
tree73f311d66aa590ead55f16bc62635a2fb61eb16b
parent16fe9dbb8213da1f0abe9ac07f1952bde10c5ca7 (diff)
downloadhdf5-e23d2acad826dd7a4155b835872f029d0fcbe09f.zip
hdf5-e23d2acad826dd7a4155b835872f029d0fcbe09f.tar.gz
hdf5-e23d2acad826dd7a4155b835872f029d0fcbe09f.tar.bz2
[svn-r12713]
added new tests with different datatypes for h5dump binary output tested: kagiso
-rw-r--r--tools/h5dump/h5dumpgentest.c68
-rw-r--r--tools/h5dump/testh5dump.sh.in8
-rw-r--r--tools/testfiles/tbin1.ddl2
-rw-r--r--tools/testfiles/tbin2.ddl2
-rw-r--r--tools/testfiles/tbin3.ddl8
-rw-r--r--tools/testfiles/tbin4.ddl8
-rw-r--r--tools/testfiles/tbinary.h5bin2096 -> 806144 bytes
7 files changed, 68 insertions, 28 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 70372da..45142e3 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -5563,33 +5563,73 @@ error:
* Contains:
* 1) an integer dataset
* 2) a float dataset
+ * 3) an array dataset
+ * 4) a large double dataset
*
*-------------------------------------------------------------------------
*/
static void gent_binary()
{
- hid_t fid, sid, idid, fdid;
+ hid_t fid, sid, did, tid;
hsize_t dims[1] = {6};
+ hsize_t dimarray[1] = {2};
+ hsize_t dimsl[1] = {100000};
int ibuf[6] = {1,2,3,4,5,6};
float fbuf[6] = {1,2,3,4,5,6};
+ int abuf[2][6] = {{1,2,3,4,5,6},{7,8,9,10,11,12}}; /* array */
+ double *dbuf=NULL;
fid = H5Fcreate(FILE55, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /* create dataspace */
+
+/*-------------------------------------------------------------------------
+ * integer
+ *-------------------------------------------------------------------------
+ */
sid = H5Screate_simple(1, dims, NULL);
-
- /* create datasets */
- idid = H5Dcreate(fid, "integer", H5T_NATIVE_INT, sid, H5P_DEFAULT);
- fdid = H5Dcreate(fid, "float", H5T_NATIVE_FLOAT, sid, H5P_DEFAULT);
-
- /* write */
- H5Dwrite(idid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf);
- H5Dwrite(fdid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbuf);
-
- /* close */
+ did = H5Dcreate(fid, "integer", H5T_NATIVE_INT, sid, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf);
+ H5Dclose(did);
+ H5Sclose(sid);
+
+/*-------------------------------------------------------------------------
+ * float
+ *-------------------------------------------------------------------------
+ */
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate(fid, "float", H5T_NATIVE_FLOAT, sid, H5P_DEFAULT);
+ H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbuf);
+ H5Dclose(did);
+ H5Sclose(sid);
+
+/*-------------------------------------------------------------------------
+ * array
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tarray_create(H5T_NATIVE_INT,1,dims,NULL);
+ sid = H5Screate_simple(1, dimarray, NULL);
+ did = H5Dcreate(fid, "array", tid, sid, H5P_DEFAULT);
+ H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, abuf);
+ H5Dclose(did);
+ H5Tclose(tid);
H5Sclose(sid);
- H5Dclose(idid);
- H5Dclose(fdid);
+
+/*-------------------------------------------------------------------------
+ * double
+ *-------------------------------------------------------------------------
+ */
+ sid = H5Screate_simple(1, dimsl, NULL);
+ did = H5Dcreate(fid, "double", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT);
+ dbuf=calloc(100000,sizeof(double));
+ if (dbuf!=NULL)
+ {
+ H5Dwrite(did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
+ free(dbuf);
+ }
+ H5Dclose(did);
+ H5Sclose(sid);
+
+ /* close */
H5Fclose(fid);
}
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 660b938..8368385 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -323,10 +323,10 @@ TOOLTEST tlonglinks.ddl tlonglinks.h5
TOOLTEST tvms.ddl tvms.h5
# test for binary output
-TOOLTEST tbin1.ddl -d integer -o out1.bin -b MEMORY tbinary.h5
-TOOLTEST tbin2.ddl -d float -o out2.bin -b FILE tbinary.h5
-TOOLTEST tbin3.ddl -d integer -o out3.bin -b LE tbinary.h5
-TOOLTEST tbin4.ddl -d float -o out4.bin -b BE tbinary.h5
+TOOLTEST tbin1.ddl -d integer -o out1.bin -b LE tbinary.h5
+TOOLTEST tbin2.ddl -d float -o out2.bin -b BE tbinary.h5
+TOOLTEST tbin3.ddl -d array -o out3.bin -b MEMORY tbinary.h5
+TOOLTEST tbin4.ddl -d double -o out4.bin -b FILE tbinary.h5
# Clean up binary output files
if test -z "$HDF5_NOCLEANUP"; then
rm -f $srcdir/../testfiles/out[1-4].bin
diff --git a/tools/testfiles/tbin1.ddl b/tools/testfiles/tbin1.ddl
index 386ecde..3adbac0 100644
--- a/tools/testfiles/tbin1.ddl
+++ b/tools/testfiles/tbin1.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for 'h5dump -d integer -o out1.bin -b MEMORY tbinary.h5'
+Expected output for 'h5dump -d integer -o out1.bin -b LE tbinary.h5'
#############################
HDF5 "tbinary.h5" {
DATASET "integer" {
diff --git a/tools/testfiles/tbin2.ddl b/tools/testfiles/tbin2.ddl
index 03f4e48..f480e60 100644
--- a/tools/testfiles/tbin2.ddl
+++ b/tools/testfiles/tbin2.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for 'h5dump -d float -o out2.bin -b FILE tbinary.h5'
+Expected output for 'h5dump -d float -o out2.bin -b BE tbinary.h5'
#############################
HDF5 "tbinary.h5" {
DATASET "float" {
diff --git a/tools/testfiles/tbin3.ddl b/tools/testfiles/tbin3.ddl
index 5226802..a49547f 100644
--- a/tools/testfiles/tbin3.ddl
+++ b/tools/testfiles/tbin3.ddl
@@ -1,10 +1,10 @@
#############################
-Expected output for 'h5dump -d integer -o out3.bin -b LE tbinary.h5'
+Expected output for 'h5dump -d array -o out3.bin -b MEMORY tbinary.h5'
#############################
HDF5 "tbinary.h5" {
-DATASET "integer" {
- DATATYPE H5T_STD_I32LE
- DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+DATASET "array" {
+ DATATYPE H5T_ARRAY { [6] H5T_STD_I32LE }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
DATA {
}
}
diff --git a/tools/testfiles/tbin4.ddl b/tools/testfiles/tbin4.ddl
index 7bd0de3..8b0b367 100644
--- a/tools/testfiles/tbin4.ddl
+++ b/tools/testfiles/tbin4.ddl
@@ -1,10 +1,10 @@
#############################
-Expected output for 'h5dump -d float -o out4.bin -b BE tbinary.h5'
+Expected output for 'h5dump -d double -o out4.bin -b FILE tbinary.h5'
#############################
HDF5 "tbinary.h5" {
-DATASET "float" {
- DATATYPE H5T_IEEE_F32LE
- DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+DATASET "double" {
+ DATATYPE H5T_IEEE_F64LE
+ DATASPACE SIMPLE { ( 100000 ) / ( 100000 ) }
DATA {
}
}
diff --git a/tools/testfiles/tbinary.h5 b/tools/testfiles/tbinary.h5
index e960d73..691b008 100644
--- a/tools/testfiles/tbinary.h5
+++ b/tools/testfiles/tbinary.h5
Binary files differ