From 0e8e2d56c5fe52f4344d6aceb80eb468756660d7 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 23 Sep 1998 18:29:25 -0500 Subject: [svn-r718] Added tests for unioning hyperslabs with the H5S_SELECT_OR operation to H5Sselect_hyperslab. --- test/tselect.c | 720 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 719 insertions(+), 1 deletion(-) diff --git a/test/tselect.c b/test/tselect.c index db0782c..116a295 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -49,6 +49,13 @@ static char RcsId[] = "$Revision$"; #define SPACE3_DIM1 15 #define SPACE3_DIM2 26 +/* 3-D dataset with fixed dimensions */ +#define SPACE4_NAME "Space4" +#define SPACE4_RANK 3 +#define SPACE4_DIM1 11 +#define SPACE4_DIM2 13 +#define SPACE4_DIM3 17 + /* Element selection information */ #define POINT1_NPOINTS 10 @@ -1412,7 +1419,716 @@ test_select_point_offset(void) /* Free memory buffers */ free(wbuf); free(rbuf); -} /* test_select_point() */ +} /* test_select_point_offset() */ + +/**************************************************************** +** +** test_select_hyper_union(): Test basic H5S (dataspace) selection code. +** Tests unions of hyperslabs of various sizes and dimensionalities. +** +****************************************************************/ +static void +test_select_hyper_union(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hid_t xfer; /* Dataset Transfer Property List ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + 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 */ + size_t begin[SPACE2_DIM1]= /* Offset within irregular block */ + {0,0,0,0,0,0,0,0,0,0, /* First ten rows start at offset 0 */ + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}; /* Next eighteen rows start at offset 5 */ + size_t len[SPACE2_DIM1]= /* Len of each row within irregular block */ + {10,10,10,10,10,10,10,10, /* First eight rows are 10 long */ + 20,20, /* Next two rows are 20 long */ + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15}; /* Next eighteen rows are 15 long */ + 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 */ + hsize_t npoints; /* Number of elements in selection */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of hyperslabs\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