summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/.distdep244
-rw-r--r--test/tselect.c134
2 files changed, 255 insertions, 123 deletions
diff --git a/test/.distdep b/test/.distdep
index 4b3f035..767ca09 100644
--- a/test/.distdep
+++ b/test/.distdep
@@ -1,3 +1,33 @@
+testhdf5.o: \
+ testhdf5.c \
+ testhdf5.h \
+ ../src/H5private.h \
+ ../src/H5public.h \
+ ../src/H5config.h
+tattr.o: \
+ tattr.c \
+ testhdf5.h \
+ ../src/H5private.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5Eprivate.h \
+ ../src/H5Epublic.h \
+ ../src/H5Ipublic.h \
+ ../src/hdf5.h \
+ ../src/H5Apublic.h \
+ ../src/H5ACpublic.h \
+ ../src/H5Bpublic.h \
+ ../src/H5Dpublic.h \
+ ../src/H5Fpublic.h \
+ ../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
+ ../src/H5HLpublic.h \
+ ../src/H5MFpublic.h \
+ ../src/H5MMpublic.h \
+ ../src/H5Opublic.h \
+ ../src/H5Ppublic.h \
+ ../src/H5Zpublic.h \
+ ../src/H5Spublic.h
tfile.o: \
tfile.c \
testhdf5.h \
@@ -100,6 +130,61 @@ tstab.o: \
../src/H5Tpublic.h \
../src/H5Sprivate.h \
../src/H5Spublic.h
+th5s.o: \
+ th5s.c \
+ testhdf5.h \
+ ../src/H5private.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5Eprivate.h \
+ ../src/H5Epublic.h \
+ ../src/H5Ipublic.h \
+ ../src/H5Bprivate.h \
+ ../src/H5Bpublic.h \
+ ../src/H5Fprivate.h \
+ ../src/H5Fpublic.h \
+ ../src/H5Dpublic.h \
+ ../src/H5Sprivate.h \
+ ../src/H5Spublic.h \
+ ../src/H5Gprivate.h \
+ ../src/H5Gpublic.h \
+ ../src/H5Oprivate.h \
+ ../src/H5Opublic.h \
+ ../src/H5HGprivate.h \
+ ../src/H5HGpublic.h \
+ ../src/H5Tprivate.h \
+ ../src/H5Tpublic.h \
+ ../src/H5Zprivate.h \
+ ../src/H5Zpublic.h \
+ ../src/H5Pprivate.h
+dtypes.o: \
+ dtypes.c \
+ ../src/hdf5.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5Ipublic.h \
+ ../src/H5Apublic.h \
+ ../src/H5ACpublic.h \
+ ../src/H5Bpublic.h \
+ ../src/H5Dpublic.h \
+ ../src/H5Epublic.h \
+ ../src/H5Fpublic.h \
+ ../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
+ ../src/H5HLpublic.h \
+ ../src/H5MFpublic.h \
+ ../src/H5MMpublic.h \
+ ../src/H5Opublic.h \
+ ../src/H5Ppublic.h \
+ ../src/H5Zpublic.h \
+ ../src/H5Spublic.h \
+ ../src/H5Tpublic.h \
+ ../src/H5Tpkg.h \
+ ../src/H5HGprivate.h \
+ ../src/H5Fprivate.h \
+ ../src/H5private.h \
+ ../src/H5Tprivate.h \
+ ../src/H5Gprivate.h
hyperslab.o: \
hyperslab.c \
../src/H5private.h \
@@ -131,6 +216,28 @@ istore.o: \
../src/H5Tprivate.h \
../src/H5Tpublic.h \
../src/H5Sprivate.h
+dsets.o: \
+ dsets.c \
+ ../src/hdf5.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5Ipublic.h \
+ ../src/H5Apublic.h \
+ ../src/H5ACpublic.h \
+ ../src/H5Bpublic.h \
+ ../src/H5Dpublic.h \
+ ../src/H5Epublic.h \
+ ../src/H5Fpublic.h \
+ ../src/H5Gpublic.h \
+ ../src/H5HGpublic.h \
+ ../src/H5HLpublic.h \
+ ../src/H5MFpublic.h \
+ ../src/H5MMpublic.h \
+ ../src/H5Opublic.h \
+ ../src/H5Ppublic.h \
+ ../src/H5Zpublic.h \
+ ../src/H5Spublic.h \
+ ../src/H5Tpublic.h
cmpd_dset.o: \
cmpd_dset.c \
../src/hdf5.h \
@@ -255,67 +362,6 @@ shtype.o: \
../src/H5Ppublic.h \
../src/H5Zpublic.h \
../src/H5Spublic.h
-links.o: \
- links.c \
- ../src/hdf5.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5Ipublic.h \
- ../src/H5Apublic.h \
- ../src/H5ACpublic.h \
- ../src/H5Bpublic.h \
- ../src/H5Dpublic.h \
- ../src/H5Epublic.h \
- ../src/H5Fpublic.h \
- ../src/H5Gpublic.h \
- ../src/H5HGpublic.h \
- ../src/H5HLpublic.h \
- ../src/H5MFpublic.h \
- ../src/H5MMpublic.h \
- ../src/H5Opublic.h \
- ../src/H5Ppublic.h \
- ../src/H5Zpublic.h \
- ../src/H5Spublic.h \
- ../src/H5Tpublic.h
-chunk.o: \
- chunk.c \
- ../src/hdf5.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5Ipublic.h \
- ../src/H5Apublic.h \
- ../src/H5ACpublic.h \
- ../src/H5Bpublic.h \
- ../src/H5Dpublic.h \
- ../src/H5Epublic.h \
- ../src/H5Fpublic.h \
- ../src/H5Gpublic.h \
- ../src/H5HGpublic.h \
- ../src/H5HLpublic.h \
- ../src/H5MFpublic.h \
- ../src/H5MMpublic.h \
- ../src/H5Opublic.h \
- ../src/H5Ppublic.h \
- ../src/H5Zpublic.h \
- ../src/H5Spublic.h \
- ../src/H5Tpublic.h
-bittests.o: \
- bittests.c \
- ../src/H5Tpkg.h \
- ../src/H5HGprivate.h \
- ../src/H5HGpublic.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5Fprivate.h \
- ../src/H5Fpublic.h \
- ../src/H5Ipublic.h \
- ../src/H5private.h \
- ../src/H5Dpublic.h \
- ../src/H5Tprivate.h \
- ../src/H5Tpublic.h \
- ../src/H5Gprivate.h \
- ../src/H5Gpublic.h \
- ../src/H5Bprivate.h
big.o: \
big.c \
../src/hdf5.h \
@@ -339,14 +385,8 @@ big.o: \
../src/H5Spublic.h \
../src/H5Tpublic.h \
../src/H5private.h
-testhdf5.o: \
- testhdf5.c \
- testhdf5.h \
- ../src/H5private.h \
- ../src/H5public.h \
- ../src/H5config.h
-dsets.o: \
- dsets.c \
+links.o: \
+ links.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -367,8 +407,8 @@ dsets.o: \
../src/H5Zpublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
-dtypes.o: \
- dtypes.c \
+chunk.o: \
+ chunk.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
@@ -388,37 +428,24 @@ dtypes.o: \
../src/H5Ppublic.h \
../src/H5Zpublic.h \
../src/H5Spublic.h \
- ../src/H5Tpublic.h \
+ ../src/H5Tpublic.h
+bittests.o: \
+ bittests.c \
../src/H5Tpkg.h \
../src/H5HGprivate.h \
- ../src/H5Fprivate.h \
- ../src/H5private.h \
- ../src/H5Tprivate.h \
- ../src/H5Gprivate.h
-tattr.o: \
- tattr.c \
- testhdf5.h \
- ../src/H5private.h \
+ ../src/H5HGpublic.h \
../src/H5public.h \
../src/H5config.h \
- ../src/H5Eprivate.h \
- ../src/H5Epublic.h \
+ ../src/H5Fprivate.h \
+ ../src/H5Fpublic.h \
../src/H5Ipublic.h \
- ../src/hdf5.h \
- ../src/H5Apublic.h \
- ../src/H5ACpublic.h \
- ../src/H5Bpublic.h \
+ ../src/H5private.h \
../src/H5Dpublic.h \
- ../src/H5Fpublic.h \
+ ../src/H5Tprivate.h \
+ ../src/H5Tpublic.h \
+ ../src/H5Gprivate.h \
../src/H5Gpublic.h \
- ../src/H5HGpublic.h \
- ../src/H5HLpublic.h \
- ../src/H5MFpublic.h \
- ../src/H5MMpublic.h \
- ../src/H5Opublic.h \
- ../src/H5Ppublic.h \
- ../src/H5Zpublic.h \
- ../src/H5Spublic.h
+ ../src/H5Bprivate.h
tselect.o: \
tselect.c \
testhdf5.h \
@@ -443,30 +470,3 @@ tselect.o: \
../src/H5Ppublic.h \
../src/H5Zpublic.h \
../src/H5Spublic.h
-th5s.o: \
- th5s.c \
- testhdf5.h \
- ../src/H5private.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5Eprivate.h \
- ../src/H5Epublic.h \
- ../src/H5Ipublic.h \
- ../src/H5Bprivate.h \
- ../src/H5Bpublic.h \
- ../src/H5Fprivate.h \
- ../src/H5Fpublic.h \
- ../src/H5Dpublic.h \
- ../src/H5Sprivate.h \
- ../src/H5Spublic.h \
- ../src/H5Gprivate.h \
- ../src/H5Gpublic.h \
- ../src/H5Oprivate.h \
- ../src/H5Opublic.h \
- ../src/H5HGprivate.h \
- ../src/H5HGpublic.h \
- ../src/H5Tprivate.h \
- ../src/H5Tpublic.h \
- ../src/H5Zprivate.h \
- ../src/H5Zpublic.h \
- ../src/H5Pprivate.h
diff --git a/test/tselect.c b/test/tselect.c
index d61dae8..d97307b 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -49,6 +49,12 @@ static char RcsId[] = "$Revision$";
#define SPACE3_DIM1 15
#define SPACE3_DIM2 26
+/* 2-D dataset with fixed dimensions */
+#define SPACE4_NAME "Space4"
+#define SPACE4_RANK 2
+#define SPACE4_DIM1 15
+#define SPACE4_DIM2 26
+
/* Element selection information */
#define POINT1_NPOINTS 10
@@ -160,7 +166,6 @@ test_select_hyper(void)
for(j=0; j<SPACE3_DIM2; j++, tbuf++, tbuf2++) {
if(*tbuf!=*tbuf2) {
printf("hyperslab values don't match!, i=%d, j=%d\n",i,j);
-exit(-1);
} /* end if */
} /* end for */
} /* end for */
@@ -329,6 +334,132 @@ test_select_point(void)
/****************************************************************
**
+** test_select_all(): Test basic H5S (dataspace) selection code.
+** Tests "all" selections.
+**
+****************************************************************/
+static void
+test_select_all(void)
+{
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset; /* Dataset ID */
+ hid_t sid1,sid2; /* Dataspace ID */
+ hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2};
+ hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */
+ uint8 *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf, /* temporary buffer pointer */
+ *tbuf2; /* temporary buffer pointer */
+ intn i,j; /* Counters */
+ herr_t ret; /* Generic return value */
+ H5S_class_t ext_type; /* Extent type */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing 'All' Selection Functions\n"));
+
+ /* Allocate write & read buffers */
+ wbuf=malloc(sizeof(uint8)*SPACE2_DIM1*SPACE2_DIM2);
+ rbuf=calloc(sizeof(uint8),SPACE3_DIM1*SPACE3_DIM2);
+
+ /* Initialize write buffer */
+ for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
+ for(j=0; j<SPACE2_DIM2; j++)
+ *tbuf++=(uint8)((i*SPACE2_DIM2)+j);
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, FAIL, "H5Fcreate");
+
+ /* Create dataspace for dataset */
+ sid1 = H5Screate_simple(SPACE3_RANK, dims1, NULL);
+ CHECK(sid1, FAIL, "H5Screate_simple");
+
+ /* Create dataspace for writing buffer */
+ sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
+ CHECK(sid2, FAIL, "H5Screate_simple");
+
+ /* Verify extent type */
+ ext_type = H5Sextent_class(sid1);
+ VERIFY(ext_type, H5S_SIMPLE, "H5Sextent_class");
+
+ /* Select entire 15x26 extent for disk dataset */
+ ret = H5Sselect_all(sid1);
+ CHECK(ret, FAIL, "H5Sselect_all");
+
+ /* Select 15x26 hyperslab for memory dataset */
+ start[0]=15; start[1]=0;
+ stride[0]=1; stride[1]=1;
+ count[0]=15; count[1]=26;
+ block[0]=1; block[1]=1;
+ ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Create a dataset */
+ dataset=H5Dcreate(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT);
+
+ /* Write selection to disk */
+ ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close memory dataspace */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Create dataspace for reading buffer */
+ sid2 = H5Screate_simple(SPACE3_RANK, dims3, NULL);
+ CHECK(sid2, FAIL, "H5Screate_simple");
+
+ /* Select 15x26 hyperslab for reading memory dataset */
+ start[0]=0; start[1]=0;
+ stride[0]=1; stride[1]=1;
+ count[0]=15; count[1]=26;
+ block[0]=1; block[1]=1;
+ ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Read selection from disk */
+ ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Compare data read with data written out */
+ for(i=0; i<SPACE3_DIM1; i++) {
+ tbuf=wbuf+((i+15)*SPACE2_DIM2);
+ tbuf2=rbuf+(i*SPACE3_DIM2);
+ for(j=0; j<SPACE3_DIM2; j++, tbuf++, tbuf2++) {
+ if(*tbuf!=*tbuf2) {
+ printf("hyperslab values don't match!, i=%d, j=%d\n",i,j);
+ } /* end if */
+ } /* end for */
+ } /* end for */
+
+ /* Close memory dataspace */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close disk dataspace */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Free memory buffers */
+ free(wbuf);
+ free(rbuf);
+} /* test_select_hyper() */
+
+/****************************************************************
+**
** test_select_combo(): Test basic H5S (dataspace) selection code.
** Tests combinations of element and hyperslab selections between
** dataspaces of various sizes and dimensionalities.
@@ -959,6 +1090,7 @@ test_select(void)
/* These next tests use the same file */
test_select_hyper(); /* Test basic H5S hyperslab selection code */
test_select_point(); /* Test basic H5S element selection code */
+ test_select_all(); /* Test basic all selection code */
test_select_combo(); /* Test combined hyperslab & element selection code */
test_select_hyper_stride(); /* Test strided hyperslab selection code */
test_select_hyper_copy(); /* Test hyperslab selection copying code */