summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2015-04-02 19:01:03 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2015-04-02 19:01:03 (GMT)
commitbe81aef60fc799b47aec3258d5d6caea8ee510ad (patch)
tree812cca77f20e12d0c0167855f6e0040313ded390 /test
parent27d820b8ced76eab5ca70304df51a0965c139e5b (diff)
downloadhdf5-be81aef60fc799b47aec3258d5d6caea8ee510ad.zip
hdf5-be81aef60fc799b47aec3258d5d6caea8ee510ad.tar.gz
hdf5-be81aef60fc799b47aec3258d5d6caea8ee510ad.tar.bz2
[svn-r26708] Port r26301 from trunk to 1.8 branch.
Tested: jam, koala, ostrich (h5committest) Log from r26633: Description: Bring Neil's fix for error in H5S_extent_copy() back to the trunk. Tested on: Mac OSX/64 10.10.2 (amazon) w/serial (h5committest forthcoming)
Diffstat (limited to 'test')
-rw-r--r--test/th5s.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/test/th5s.c b/test/th5s.c
index 6668421..7980215 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -2212,6 +2212,97 @@ test_h5s_extent_equal(void)
/****************************************************************
**
+** test_h5s_extent_copy(): Exercise extent copy code
+**
+****************************************************************/
+static void
+test_h5s_extent_copy(void)
+{
+ hid_t spaces[14] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; /* Array of all dataspaces */
+ hid_t tmp_space = -1;
+ hsize_t d1_dims1[1] = {10}, /* 1-D dimensions */
+ d1_dims2[1] = {20},
+ d1_dims3[1] = {H5S_UNLIMITED};
+ hsize_t d2_dims1[2] = {10, 10}, /* 2-D dimensions */
+ d2_dims2[2] = {20, 20},
+ d2_dims3[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ 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};
+ htri_t ext_equal; /* Whether two dataspace extents are equal */
+ const unsigned num_spaces = sizeof(spaces) / sizeof(spaces[0]);
+ unsigned i, j;
+ herr_t ret; /* Generic error return */
+
+ /* Create dataspaces */
+ spaces[0] = H5Screate(H5S_NULL);
+ CHECK(spaces[0], FAIL, "H5Screate");
+
+ spaces[1] = H5Screate(H5S_SCALAR);
+ CHECK(spaces[1], FAIL, "H5Screate");
+
+ spaces[2] = H5Screate_simple(1, d1_dims1, NULL);
+ CHECK(spaces[2], FAIL, "H5Screate");
+ spaces[3] = H5Screate_simple(1, d1_dims2, NULL);
+ CHECK(spaces[3], FAIL, "H5Screate");
+ spaces[4] = H5Screate_simple(1, d1_dims1, d1_dims2);
+ CHECK(spaces[4], FAIL, "H5Screate");
+ spaces[5] = H5Screate_simple(1, d1_dims1, d1_dims3);
+ CHECK(spaces[5], FAIL, "H5Screate");
+
+ spaces[6] = H5Screate_simple(2, d2_dims1, NULL);
+ CHECK(spaces[6], FAIL, "H5Screate");
+ spaces[7] = H5Screate_simple(2, d2_dims2, NULL);
+ CHECK(spaces[7], FAIL, "H5Screate");
+ spaces[8] = H5Screate_simple(2, d2_dims1, d2_dims2);
+ CHECK(spaces[8], FAIL, "H5Screate");
+ spaces[9] = H5Screate_simple(2, d2_dims1, d2_dims3);
+ CHECK(spaces[9], FAIL, "H5Screate");
+
+ spaces[10] = H5Screate_simple(3, d3_dims1, NULL);
+ CHECK(spaces[10], FAIL, "H5Screate");
+ spaces[11] = H5Screate_simple(3, d3_dims2, NULL);
+ CHECK(spaces[11], FAIL, "H5Screate");
+ spaces[12] = H5Screate_simple(3, d3_dims1, d3_dims2);
+ CHECK(spaces[12], FAIL, "H5Screate");
+ spaces[13] = H5Screate_simple(3, d3_dims1, d3_dims3);
+ CHECK(spaces[13], FAIL, "H5Screate");
+
+ tmp_space = H5Screate(H5S_NULL);
+ CHECK(tmp_space, FAIL, "H5Screate");
+
+ /* Copy between all dataspace combinations. Note there are a few
+ * duplicates. */
+ for(i = 0; i < num_spaces; i++)
+ for(j = i; j < num_spaces; j++) {
+ /* Copy from i to j, unless the inner loop just restarted, in which
+ * case i and j are the same, so the second call to H5Sextent_copy()
+ * will test copying from i/j to i/j */
+ ret = H5Sextent_copy(tmp_space, spaces[j]);
+ CHECK(ret, FAIL, "H5Sextent_copy");
+ ext_equal = H5Sextent_equal(tmp_space, spaces[j]);
+ VERIFY(ext_equal, TRUE, "H5Sextent_equal");
+
+ /* Copy from j to i */
+ ret = H5Sextent_copy(tmp_space, spaces[i]);
+ CHECK(ret, FAIL, "H5Sextent_copy");
+ ext_equal = H5Sextent_equal(tmp_space, spaces[i]);
+ VERIFY(ext_equal, TRUE, "H5Sextent_equal");
+ } /* end for */
+
+ /* Close dataspaces */
+ for(i = 0; i < num_spaces; i++) {
+ ret = H5Sclose(spaces[i]);
+ CHECK(ret, FAIL, "H5Sclose");
+ spaces[i] = -1;
+ } /* end for */
+
+ ret = H5Sclose(tmp_space);
+ CHECK(ret, FAIL, "H5Sclose");
+} /* test_h5s_extent_copy() */
+
+/****************************************************************
+**
** test_h5s(): Main H5S (dataspace) testing routine.
**
****************************************************************/
@@ -2235,6 +2326,7 @@ test_h5s(void)
test_h5s_chunk(); /* Exercise bug fix for chunked I/O */
test_h5s_extent_equal(); /* Test extent comparison code */
+ test_h5s_extent_copy(); /* Test extent copy code */
} /* test_h5s() */