From 05e8b74a20c22c372b8d617a25db0fe31846a165 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 30 Apr 2002 09:46:18 -0500 Subject: [svn-r5290] Purpose: Bug Fix Description: Corrected int vs. unsigned short error that only showed up on big-endian machines. Also, add more testing to verify that the coordinates reported for each element iterated through with H5Diterate are correct. Platforms tested: FreeBSD 4.5 (sleipnir) --- test/tselect.c | 194 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 148 insertions(+), 46 deletions(-) diff --git a/test/tselect.c b/test/tselect.c index 4cb4495..7358d5b 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -4412,22 +4412,46 @@ test_select_combine(void) CHECK(error, FAIL, "H5Sclose"); } /* test_select_combine() */ +/* + * Typedef for iteration structure used in the fill value tests + */ +typedef struct { + unsigned short fill_value; /* The fill value to check */ + size_t curr_coord; /* Current coordinate to examine */ + hssize_t *coords; /* Pointer to selection's coordinates */ +} fill_iter_info; + /**************************************************************** ** ** test_select_hyper_iter3(): Iterator for checking hyperslab iteration ** ****************************************************************/ herr_t -test_select_hyper_iter3(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *_operator_data) +test_select_hyper_iter3(void *_elem,hid_t UNUSED type_id, hsize_t ndim, hssize_t *point, void *_operator_data) { - unsigned short *tbuf=(unsigned short *)_elem, /* temporary buffer pointer */ - *tbuf2=(unsigned short *)_operator_data; /* temporary buffer handle */ + unsigned short *tbuf=(unsigned short *)_elem; /* temporary buffer pointer */ + fill_iter_info *iter_info=(fill_iter_info *)_operator_data; /* Get the pointer to the iterator information */ + hssize_t *coord_ptr; /* Pointer to the coordinate information for a point*/ - /* Simple check to make certain the values in the selected points match */ - if(*tbuf!=*tbuf2) + /* Check value in current buffer location */ + if(*tbuf!=iter_info->fill_value) return(-1); - else - return(0); + else { + /* Check number of dimensions */ + if(ndim!=SPACE7_RANK) + return(-1); + else { + /* Check Coordinates */ + coord_ptr=iter_info->coords+(2*iter_info->curr_coord); + iter_info->curr_coord++; + if(coord_ptr[0]!=point[0]) + return(-1); + else if(coord_ptr[1]!=point[1]) + return(-1); + else + return(0); + } /* end else */ + } /* end else */ } /* end test_select_hyper_iter3() */ /**************************************************************** @@ -4442,6 +4466,8 @@ test_select_fill_all(void) hid_t sid1; /* Dataspace ID */ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2}; int fill_value; /* Fill value */ + fill_iter_info iter_info; /* Iterator information structure */ + hssize_t points[SPACE7_DIM1*SPACE7_DIM2][SPACE7_RANK]; /* Coordinates of selection */ unsigned short *wbuf, /* buffer to write to disk */ *tbuf; /* temporary buffer pointer */ int i,j; /* Counters */ @@ -4479,8 +4505,20 @@ test_select_fill_all(void) printf("Error! j=%d, i=%d, *tbuf=%x, fill_value=%x\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); } /* end if */ + /* Set the coordinates of the selection */ + for(i=0; i