summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-01-30 23:32:28 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-01-30 23:32:28 (GMT)
commit374e5ae39b6f05469c1bcbdcaf0a473f1dde1385 (patch)
tree3284232ef8b21758da14fe63347b903d3883c3c4 /test
parentd9329a23aab4d941956ac421b11eb009a2deb32b (diff)
downloadhdf5-374e5ae39b6f05469c1bcbdcaf0a473f1dde1385.zip
hdf5-374e5ae39b6f05469c1bcbdcaf0a473f1dde1385.tar.gz
hdf5-374e5ae39b6f05469c1bcbdcaf0a473f1dde1385.tar.bz2
[svn-r209] Changes since 19980130
---------------------- ./INSTALL Added instructions for which C flags to set for debugging. ./src/H5C.c ./src/H5Cpublic.h H5Cset_chunk() takes const pointer. ./src/H5D.c ./src/H5Dprivate.h ./src/H5Dpublic.h Added H5Dextend() to extend the dimensions of a dataset. ./src/H5Osdspace.c ./src/H5P.c ./src/H5Pprivate.h ./src/H5Ppublic.h ./test/cmpd_dset.c ./test/dsets.c ./test/th5p.c Added the optional `maxdims' argument to H5Pcreate_simple() and defined constant H5P_UNLIMITED which can appear in the maxdims. Added `const' to arguments. Implemented H5Pcopy() Removed the unused file argument from H5P_modify. Added H5P_extend(). Removed the `flags' field from simple data types and we determine if the `max' or `perm' arrays are valid by looking at the pointer. Cleaned up the H5O_sdspace_debug output. ./src/H5T.c Fixed a printf format. ./MANIFEST ./test/Makefile.in ./test/extend.c [NEW] Added a test for multi-dimensional unlimited dimensions.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.in12
-rw-r--r--test/cmpd_dset.c6
-rw-r--r--test/dsets.c6
-rw-r--r--test/extend.c131
-rw-r--r--test/th5p.c4
5 files changed, 148 insertions, 11 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
index a2259cd..76cc68d 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -11,11 +11,11 @@ CPPFLAGS=-I. -I../src @CPPFLAGS@
# These are our main targets. They should be listed in the order to be
# executed, generally most specific tests to least specific tests.
-PROGS=testhdf5 hyperslab istore dtypes dsets cmpd_dset
+PROGS=testhdf5 hyperslab istore dtypes dsets cmpd_dset extend
TESTS=$(PROGS)
# Temporary files
-MOSTLYCLEAN=cmpd_dset.h5 dataset.h5 istore.h5 tfile1.h5 tfile2.h5 \
+MOSTLYCLEAN=cmpd_dset.h5 dataset.h5 extend.h5 istore.h5 tfile1.h5 tfile2.h5 \
tfile3.h5 th5p1.h5 theap.h5 tohdr.h5 tstab1.h5 tstab2.h5
# Source and object files for programs... The PROG_SRC list contains all the
@@ -23,7 +23,7 @@ MOSTLYCLEAN=cmpd_dset.h5 dataset.h5 istore.h5 tfile1.h5 tfile2.h5 \
# other source lists are for the individual tests, the files of which may
# overlap with other tests.
PROG_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5p.c dtypes.c \
- hyperslab.c istore.c dsets.c cmpd_dset.c
+ hyperslab.c istore.c dsets.c cmpd_dset.c extend.c
PROG_OBJ=$(PROG_SRC:.c=.o)
TESTHDF5_SRC=testhdf5.c tfile.c theap.c tmeta.c tohdr.c tstab.c th5p.c
@@ -44,6 +44,9 @@ ISTORE_OBJ=$(ISTORE_SRC:.c=.o)
CMPD_DSET_SRC=cmpd_dset.c
CMPD_DSET_OBJ=$(CMPD_DSET_SRC:.c=.o)
+EXTEND_SRC=extend.c
+EXTEND_OBJ=$(EXTEND_SRC:.c=.o)
+
# Private header files (not to be installed)...
PRIVATE_HDR=testhdf5.h
@@ -66,4 +69,7 @@ istore: $(ISTORE_OBJ) ../src/libhdf5.a
cmpd_dset: $(CMPD_DSET_OBJ) ../src/libhdf5.a
$(CC) $(CFLAGS) -o $@ $(CMPD_DSET_OBJ) ../src/libhdf5.a $(LIBS)
+extend: $(EXTEND_OBJ) ../src/libhdf5.a
+ $(CC) $(CFLAGS) -o $@ $(EXTEND_OBJ) ../src/libhdf5.a $(LIBS)
+
@CONCLUDE@
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index 489d8f4..c8afe38 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -134,7 +134,7 @@ main (void)
assert (file>=0);
/* Create the data space */
- space = H5Pcreate_simple (2, dim);
+ space = H5Pcreate_simple (2, dim, NULL);
assert (space>=0);
@@ -356,7 +356,7 @@ STEP 7: Reading original dataset with explicit data space.\n");
fflush (stdout);
/* Create the data space */
- s7_sid = H5Pcreate_simple (2, dim);
+ s7_sid = H5Pcreate_simple (2, dim, NULL);
assert (s7_sid>=0);
/* Read the dataset */
@@ -395,7 +395,7 @@ STEP 8: Read middle third hyperslab into memory array.\n");
assert (status>=0);
/* Create memory data space */
- s8_m_sid = H5Pcreate_simple (2, h_size);
+ s8_m_sid = H5Pcreate_simple (2, h_size, NULL);
assert (s8_m_sid>=0);
/* Read the dataset */
diff --git a/test/dsets.c b/test/dsets.c
index 58bfc4c..783ace3 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -56,7 +56,7 @@ test_create(hid_t file)
/* Create the data space */
dims[0] = 256;
dims[1] = 512;
- space = H5Pcreate_simple(2,dims);
+ space = H5Pcreate_simple(2, dims, NULL);
assert(space != FAIL);
/*
@@ -208,7 +208,7 @@ test_simple_io(hid_t file)
/* Create the data space */
dims[0] = 100;
dims[1] = 200;
- space = H5Pcreate_simple(2,dims);
+ space = H5Pcreate_simple(2, dims, NULL);
assert(space != FAIL);
/* Create the dataset */
@@ -296,7 +296,7 @@ test_tconv(hid_t file)
/* Create the data space */
dims[0] = 1000000;
- space = H5Pcreate_simple(1,dims);
+ space = H5Pcreate_simple (1, dims, NULL);
assert(space != FAIL);
/* Create the data set */
diff --git a/test/extend.c b/test/extend.c
new file mode 100644
index 0000000..8cadd6a
--- /dev/null
+++ b/test/extend.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 1998 Spizella Software
+ * All rights reserved.
+ *
+ * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Friday, January 30, 1998
+ *
+ * Purpose: Tests extendable datasets.
+ */
+#include <assert.h>
+#include <hdf5.h>
+
+#define NX 100 /* USE AN EVEN NUMBER!*/
+#define NY 100 /* USE AN EVEN NUMBER!*/
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests extendable datasets
+ *
+ * Return: Success: exit(0)
+ *
+ * Failure: exit(non-zero)
+ *
+ * Programmer: Robb Matzke
+ * Friday, January 30, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main (void)
+{
+ hid_t file, dataset, mem_space, file_space, cparms;
+ herr_t status;
+ int i, j, k, m;
+ static int buf1[NY][NX], buf2[NX/2][NY/2];
+ static const size_t dims[2] = {NX, NY};
+ static const size_t half_dims[2] = {NX/2, NY/2};
+ static size_t maxdims[2] = {H5P_UNLIMITED, H5P_UNLIMITED};
+ static size_t size[2];
+ int offset[2];
+
+ /* Initialize buffer and space */
+ for (i=0; i<NX; i++) {
+ for (j=0; j<NY; j++) {
+ buf1[i][j] = i*NY+j;
+ }
+ }
+ mem_space = H5Pcreate_simple (2, dims, maxdims);
+ assert (mem_space>=0);
+
+ /* Create the file */
+ file = H5Fcreate ("extend.h5", H5ACC_OVERWRITE, H5C_DEFAULT, H5C_DEFAULT);
+ assert (file>=0);
+
+ /* Create the dataset which is originally NX by NY */
+ cparms = H5Ccreate (H5C_DATASET_CREATE);
+ assert (cparms>=0);
+ status = H5Cset_chunk (cparms, 2, dims);
+ assert (status>=0);
+ dataset = H5Dcreate (file, "dataset", H5T_NATIVE_INT, mem_space, cparms);
+ assert (dataset>=0);
+
+ /* Write the data */
+ for (i=0; i<5; i++) {
+ for (j=0; j<5; j++) {
+
+ /* Extend the dataset */
+ offset[0] = i * NX;
+ offset[1] = j * NY;
+ size[0] = offset[0] + NX;
+ size[1] = offset[1] + NY;
+ status = H5Dextend (dataset, size);
+ assert (status>=0);
+
+ /* Select a hyperslab */
+ file_space = H5Dget_space (dataset);
+ assert (file_space>=0);
+ status = H5Pset_hyperslab (file_space, offset, dims, NULL);
+ assert (status>=0);
+
+ /* Write to the hyperslab */
+ status = H5Dwrite (dataset, H5T_NATIVE_INT, mem_space, file_space,
+ H5C_DEFAULT, buf1);
+ assert (status>=0);
+ H5Pclose (file_space);
+ }
+ }
+ H5Pclose (mem_space);
+
+
+ /* Read the data */
+ mem_space = H5Pcreate_simple (2, half_dims, NULL);
+ for (i=0; i<10; i++) {
+ for (j=0; j<10; j++) {
+
+ /* Select a hyperslab */
+ offset[0] = i * NX/2;
+ offset[1] = j * NY/2;
+ file_space = H5Dget_space (dataset);
+ assert (file_space>=0);
+ status = H5Pset_hyperslab (file_space, offset, half_dims, NULL);
+ assert (status>=0);
+
+ /* Read */
+ status = H5Dread (dataset, H5T_NATIVE_INT, mem_space, file_space,
+ H5C_DEFAULT, buf2);
+ assert (status>=0);
+ H5Pclose (file_space);
+
+ /* Compare */
+ for (k=0; k<NX/2; k++) {
+ for (m=0; m<NY/2; m++) {
+ assert (buf2[k][m]==buf1[(i%2)*NX/2+k][(j%2)*NY/2+m]);
+ }
+ }
+ }
+ }
+
+
+ H5Dclose (dataset);
+ H5Fclose (file);
+
+ exit (0);
+}
+
+
+
diff --git a/test/th5p.c b/test/th5p.c
index 223c54e..e969219 100644
--- a/test/th5p.c
+++ b/test/th5p.c
@@ -73,7 +73,7 @@ test_h5p_basic(void)
fid1 = H5Fcreate(FILE, H5ACC_OVERWRITE, 0, 0);
CHECK(fid1, FAIL, "H5Fcreate");
- sid1 = H5Pcreate_simple(SPACE1_RANK, dims1);
+ sid1 = H5Pcreate_simple(SPACE1_RANK, dims1, NULL);
CHECK(sid1, FAIL, "H5Pcreate_simple");
n = H5Pget_npoints(sid1);
@@ -88,7 +88,7 @@ test_h5p_basic(void)
CHECK(ret, FAIL, "H5Pget_ldims");
VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(uint32)), 0, "H5Pget_ldims");
- sid2 = H5Pcreate_simple(SPACE2_RANK, dims2);
+ sid2 = H5Pcreate_simple(SPACE2_RANK, dims2, NULL);
CHECK(sid2, FAIL, "H5Pcreate_simple");
n = H5Pget_npoints(sid2);