summaryrefslogtreecommitdiffstats
path: root/test/dsets.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2013-02-08 16:49:21 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2013-02-08 16:49:21 (GMT)
commit692fa69934553e34a7166fd919b90309bc4ecb23 (patch)
treee040dd69a95938a9de499ac6582ce5ac8aab1079 /test/dsets.c
parent386f73823af1fbe6bd39e9bce3c247c183ae56c1 (diff)
downloadhdf5-692fa69934553e34a7166fd919b90309bc4ecb23.zip
hdf5-692fa69934553e34a7166fd919b90309bc4ecb23.tar.gz
hdf5-692fa69934553e34a7166fd919b90309bc4ecb23.tar.bz2
[svn-r23237] Purpose: Implement H5Dscatter and H5Dgather
Description: Adds 2 new API functions, H5Dscatter and H5Dgather. H5Dscatter retrieves data from a specified callback function and scatters it into a selection, defined by a supplied dataspace, within a supplied memory buffer. H5Dgather gathers data from a selection within a supplied memory buffer and passes it in a contiguous form to a supplied callback function. Added tests for these functions Tested: jam, ostrich, koala (h5committest); ummon
Diffstat (limited to 'test/dsets.c')
-rw-r--r--test/dsets.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/dsets.c b/test/dsets.c
index 7689a81..7abe818 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -8624,6 +8624,22 @@ test_gather(void)
if(gather_info.expect_dst_buf - expect_dst_buf != 8) TEST_ERROR
} /* end for */
+ /* Test without a callback */
+ /* Loop over buffer sizes */
+ for(dst_buf_size=8; dst_buf_size<=9; dst_buf_size++) {
+ /* Reset dst_buf */
+ (void)HDmemset(dst_buf, 0, sizeof(dst_buf));
+
+ /* Gather data */
+ if(H5Dgather(sid, src_buf, H5T_NATIVE_INT, dst_buf_size * sizeof(dst_buf[0]), dst_buf, NULL, NULL) < 0)
+ TEST_ERROR
+
+ /* Verify data */
+ for(i=0; i<(int)(sizeof(dst_buf)/sizeof(dst_buf[0])); i++)
+ if(dst_buf[i] != expect_dst_buf[i])
+ TEST_ERROR
+ } /* end for */
+
/* Test with a dst_buf_size that is not a multiple of the datatype size */
/* Reset dst_buf */
dst_buf_size = 7;
@@ -9155,7 +9171,7 @@ test_gather_error(void)
gather_info.expect_dst_buf = expect_dst_buf;
gather_info.last_call = FALSE;
H5E_BEGIN_TRY {
- ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 6 * sizeof(dst_buf[0]), dst_buf, NULL, &gather_info);
+ ret = H5Dgather(sid, src_buf, H5T_NATIVE_INT, 5 * sizeof(dst_buf[0]), dst_buf, NULL, &gather_info);
} H5E_END_TRY
if(ret >= 0) TEST_ERROR