From 9039c9ecd9d8b5bb32e5b4729f4ba543dbe9300f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 25 Jun 1999 14:37:40 -0500 Subject: [svn-r1386] Added tests to iterate through hyperslab and point selections. --- test/tselect.c | 85 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 22 deletions(-) diff --git a/test/tselect.c b/test/tselect.c index 4e431ad..195265a 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -62,6 +62,28 @@ static char RcsId[] = "$Revision$"; /* Location comparison function */ int compare_size_t(const void *s1, const void *s2); +herr_t test_select_hyper_iter1(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data); +herr_t test_select_point_iter1(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data); + +/**************************************************************** +** +** test_select_hyper_iter1(): Iterator for checking hyperslab iteration +** +****************************************************************/ +herr_t +test_select_hyper_iter1(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *_operator_data) +{ + uint8_t *tbuf=(uint8_t *)_elem, /* temporary buffer pointer */ + **tbuf2=(uint8_t **)_operator_data; /* temporary buffer handle */ + + if(*tbuf!=**tbuf2) + return(-1); + else { + (*tbuf2)++; + return(0); + } +} /* end test_select_hyper_iter1() */ + /**************************************************************** ** ** test_select_hyper(): Test basic H5S (dataspace) selection code. @@ -83,8 +105,7 @@ test_select_hyper(void) hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ - *tbuf, /* temporary buffer pointer */ - *tbuf2; /* temporary buffer pointer */ + *tbuf; /* temporary buffer pointer */ intn i,j; /* Counters */ herr_t ret; /* Generic return value */ H5S_class_t ext_type; /* Extent type */ @@ -160,16 +181,10 @@ test_select_hyper(void) 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; ibuf+(pnt_info->coord[pnt_info->offset][0]*SPACE2_DIM2)+pnt_info->coord[pnt_info->offset][1]; + if(*elem!=*tmp) + return(-1); + else { + pnt_info->offset++; + return(0); + } +} /* end test_select_hyper_iter1() */ + /**************************************************************** ** ** test_select_point(): Test basic H5S (dataspace) selection code. @@ -213,9 +256,9 @@ test_select_point(void) hssize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ - *tbuf, /* temporary buffer pointer */ - *tbuf2; /* temporary buffer pointer */ + *tbuf; /* temporary buffer pointer */ intn i,j; /* Counters */ + struct pnt_iter pi; /* Custom Pointer iterator struct */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -303,14 +346,12 @@ test_select_point(void) 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