From 650e88756c4d81f819141d28e9239fbb6446ed30 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 6 Jul 1998 16:01:59 -0500 Subject: [svn-r452] Changed tests to use the new dataspace API calls. Still need to add tests for point selections and strides. --- test/big.c | 4 ++-- test/chunk.c | 4 ++-- test/cmpd_dset.c | 6 +++--- test/dsets.c | 4 +++- test/extend.c | 6 ++---- test/external.c | 4 ++-- test/iopipe.c | 2 +- test/th5s.c | 15 +++++++++++---- 8 files changed, 26 insertions(+), 19 deletions(-) diff --git a/test/big.c b/test/big.c index c45690a..6dd72bb 100644 --- a/test/big.c +++ b/test/big.c @@ -85,7 +85,7 @@ writer (int wrt_n) for (i=0; i=0); /* Create memory data space */ @@ -547,6 +545,7 @@ STEP 10: Read middle third of hyperslab into middle third of memory array\n\ } } +#ifdef OLD_WAY /* *###################################################################### * Step 11: Write an array into the middle third of the dataset @@ -598,6 +597,7 @@ STEP 11: Write an array back to the middle third of the dataset to\n\ } } } +#endif /* OLD_WAY */ diff --git a/test/dsets.c b/test/dsets.c index a3c15df..9eccc2d 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -582,7 +582,7 @@ test_compression(hid_t file) points[hs_offset[0]+i][hs_offset[1]+j] = rand (); } } - H5Sset_hyperslab (space, hs_offset, hs_size, NULL); + H5Sselect_hyperslab (space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL); status = H5Dwrite (dataset, H5T_NATIVE_INT, space, space, xfer, points); if (status<0) goto error; @@ -599,6 +599,8 @@ test_compression(hid_t file) printf(" At index %lu,%lu\n", (unsigned long)(hs_offset[0]+i), (unsigned long)(hs_offset[1]+j)); + printf(" At original: %d\n", (int)points[hs_offset[0]+i][hs_offset[1]+j]); + printf(" At returned: %d\n", (int)check[hs_offset[0]+i][hs_offset[1]+j]); goto error; } } diff --git a/test/extend.c b/test/extend.c index d1b3d0e..15f2322 100644 --- a/test/extend.c +++ b/test/extend.c @@ -107,7 +107,7 @@ main (void) /* Select a hyperslab */ file_space = H5Dget_space (dataset); assert (file_space>=0); - status = H5Sset_hyperslab (file_space, offset, dims, NULL); + status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, offset, NULL, dims, NULL); assert (status>=0); /* Write to the hyperslab */ @@ -130,7 +130,7 @@ main (void) offset[0] = i * NX/2; offset[1] = j * NY/2; assert (file_space>=0); - status = H5Sset_hyperslab (file_space, offset, half_dims, NULL); + status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL); assert (status>=0); /* Read */ @@ -155,5 +155,3 @@ main (void) return 0; } - - diff --git a/test/external.c b/test/external.c index d552ac0..03943f8 100644 --- a/test/external.c +++ b/test/external.c @@ -599,7 +599,7 @@ test_2 (void) hs_space = H5Scopy (space); assert (hs_space>=0); - status = H5Sset_hyperslab (hs_space, &hs_start, &hs_count, NULL); + status = H5Sselect_hyperslab (hs_space, H5S_SELECT_SET, &hs_start, NULL, &hs_count, NULL); assert (status>=0); memset (whole, 0, sizeof(whole)); @@ -751,7 +751,7 @@ test_3 (void) for (i=0; i=0); status = H5Dwrite (dset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, whole); diff --git a/test/iopipe.c b/test/iopipe.c index d236ed1..447f483 100644 --- a/test/iopipe.c +++ b/test/iopipe.c @@ -318,7 +318,7 @@ main (void) assert (size[0]>20 && size[1]>20); start[0] = start[1] = 10; count[0] = count[1] = size[0]-20; - status = H5Sset_hyperslab (file_space, start, count, NULL); + status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, start, NULL, count, NULL); assert (status>=0); synchronize (); #ifdef HAVE_GETRUSAGE diff --git a/test/th5s.c b/test/th5s.c index be866af..4102ea9 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -47,6 +47,10 @@ static char RcsId[] = "$Revision$"; #define SPACE2_DIM2 15 #define SPACE2_DIM3 13 #define SPACE2_DIM4 23 +#define SPACE2_MAX1 H5S_UNLIMITED +#define SPACE2_MAX2 15 +#define SPACE2_MAX3 13 +#define SPACE2_MAX4 23 /* Scalar dataset with simple datatype */ #define SPACE3_NAME "Scalar1" @@ -83,9 +87,10 @@ test_h5s_basic(void) hid_t sid1, sid2; /* Dataspace ID */ unsigned rank; /* Logical rank of dataspace */ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3, - SPACE2_DIM4}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3, SPACE2_DIM4}; + hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4}; hsize_t tdims[4]; /* Dimension array to test with */ + hsize_t tmax[4]; size_t n; /* Number of dataspace elements */ herr_t ret; /* Generic return value */ @@ -112,7 +117,7 @@ test_h5s_basic(void) VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0, "H5Sget_ldims"); - sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL); + sid2 = H5Screate_simple(SPACE2_RANK, dims2, max2); CHECK(sid2, FAIL, "H5Screate_simple"); n = H5Sget_npoints(sid2); @@ -124,10 +129,12 @@ test_h5s_basic(void) CHECK(rank, UFAIL, "H5Sget_lrank"); VERIFY(rank, SPACE2_RANK, "H5Sget_lrank"); - ret = H5Sget_dims(sid2, tdims, NULL); + ret = H5Sget_dims(sid2, tdims, tmax); CHECK(ret, FAIL, "H5Sget_ldims"); VERIFY(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0, "H5Sget_ldims"); + VERIFY(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0, + "H5Sget_ldims"); ret = H5Sclose(sid1); CHECK(ret, FAIL, "H5Sclose"); -- cgit v0.12