diff options
Diffstat (limited to 'test/th5s.c')
-rw-r--r-- | test/th5s.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/test/th5s.c b/test/th5s.c index 94268a7..7c1c46e 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1581,7 +1581,7 @@ test_h5s_compound_scalar_read(void) if(HDmemcmp(&space4_data,&rdata,sizeof(struct space4_struct))) { printf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",space4_data.c1,rdata.c1); printf("scalar data different: space4_data.u=%u, read_data4.u=%u\n",space4_data.u,rdata.u); - printf("scalar data different: space4_data.f=%f, read_data4.f=%f\n",space4_data.f,rdata.f); + printf("scalar data different: space4_data.f=%f, read_data4.f=%f\n",(double)space4_data.f,(double)rdata.f); TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",space4_data.c1,rdata.c2); } /* end if */ @@ -1684,7 +1684,7 @@ test_h5s_chunk(void) for(j=0; j<3; j++) { /* Check if the two values are within 0.001% range. */ if(!DBL_REL_EQUAL(chunk_data_dbl[i][j], chunk_data_flt[i][j], 0.00001F)) - TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, chunk_data_flt[i][j]); + TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, (double)chunk_data_flt[i][j]); } /* end for */ } /* end for */ } /* test_h5s_chunk() */ @@ -2224,6 +2224,8 @@ test_h5s_extent_copy(void) hsize_t d3_dims1[3] = {10, 10, 10}, /* 3-D dimensions */ d3_dims2[3] = {20, 20, 20}, d3_dims3[3] = {H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t npoints[14]; /* Expected number of points in selection for each element in spaces */ + hssize_t npoints_ret; /* Number of points returned by H5Sget_select_npoints() */ htri_t ext_equal; /* Whether two dataspace extents are equal */ const unsigned num_spaces = sizeof(spaces) / sizeof(spaces[0]); unsigned i, j; @@ -2232,36 +2234,50 @@ test_h5s_extent_copy(void) /* Create dataspaces */ spaces[0] = H5Screate(H5S_NULL); CHECK(spaces[0], FAIL, "H5Screate"); + npoints[0] = (hsize_t)0; spaces[1] = H5Screate(H5S_SCALAR); CHECK(spaces[1], FAIL, "H5Screate"); + npoints[1] = (hsize_t)1; spaces[2] = H5Screate_simple(1, d1_dims1, NULL); CHECK(spaces[2], FAIL, "H5Screate"); + npoints[2] = d1_dims1[0]; spaces[3] = H5Screate_simple(1, d1_dims2, NULL); CHECK(spaces[3], FAIL, "H5Screate"); + npoints[3] = d1_dims2[0]; spaces[4] = H5Screate_simple(1, d1_dims1, d1_dims2); CHECK(spaces[4], FAIL, "H5Screate"); + npoints[4] = d1_dims1[0]; spaces[5] = H5Screate_simple(1, d1_dims1, d1_dims3); CHECK(spaces[5], FAIL, "H5Screate"); + npoints[5] = d1_dims1[0]; spaces[6] = H5Screate_simple(2, d2_dims1, NULL); CHECK(spaces[6], FAIL, "H5Screate"); + npoints[6] = d2_dims1[0] * d2_dims1[1]; spaces[7] = H5Screate_simple(2, d2_dims2, NULL); CHECK(spaces[7], FAIL, "H5Screate"); + npoints[7] = d2_dims2[0] * d2_dims2[1]; spaces[8] = H5Screate_simple(2, d2_dims1, d2_dims2); CHECK(spaces[8], FAIL, "H5Screate"); + npoints[8] = d2_dims1[0] * d2_dims1[1]; spaces[9] = H5Screate_simple(2, d2_dims1, d2_dims3); CHECK(spaces[9], FAIL, "H5Screate"); + npoints[9] = d2_dims1[0] * d2_dims1[1]; spaces[10] = H5Screate_simple(3, d3_dims1, NULL); CHECK(spaces[10], FAIL, "H5Screate"); + npoints[10] = d3_dims1[0] * d3_dims1[1] * d3_dims1[2]; spaces[11] = H5Screate_simple(3, d3_dims2, NULL); CHECK(spaces[11], FAIL, "H5Screate"); + npoints[11] = d3_dims2[0] * d3_dims2[1] * d3_dims2[2]; spaces[12] = H5Screate_simple(3, d3_dims1, d3_dims2); CHECK(spaces[12], FAIL, "H5Screate"); + npoints[12] = d3_dims1[0] * d3_dims1[1] * d3_dims1[2]; spaces[13] = H5Screate_simple(3, d3_dims1, d3_dims3); CHECK(spaces[13], FAIL, "H5Screate"); + npoints[13] = d3_dims1[0] * d3_dims1[1] * d3_dims1[2]; tmp_space = H5Screate(H5S_NULL); CHECK(tmp_space, FAIL, "H5Screate"); @@ -2275,14 +2291,26 @@ test_h5s_extent_copy(void) * will test copying from i/j to i/j */ ret = H5Sextent_copy(tmp_space, spaces[j]); CHECK(ret, FAIL, "H5Sextent_copy"); + + /* Verify that the extents are equal */ ext_equal = H5Sextent_equal(tmp_space, spaces[j]); VERIFY(ext_equal, TRUE, "H5Sextent_equal"); + /* Verify that the correct number of elements is selected */ + npoints_ret = H5Sget_select_npoints(tmp_space); + VERIFY((hsize_t)npoints_ret, npoints[j], "H5Sget_select_npoints"); + /* Copy from j to i */ ret = H5Sextent_copy(tmp_space, spaces[i]); CHECK(ret, FAIL, "H5Sextent_copy"); + + /* Verify that the extents are equal */ ext_equal = H5Sextent_equal(tmp_space, spaces[i]); VERIFY(ext_equal, TRUE, "H5Sextent_equal"); + + /* Verify that the correct number of elements is selected */ + npoints_ret = H5Sget_select_npoints(tmp_space); + VERIFY((hsize_t)npoints_ret, npoints[i], "H5Sget_select_npoints"); } /* end for */ /* Close dataspaces */ |