summaryrefslogtreecommitdiffstats
path: root/test/tcoords.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
commitb2d661b508a7fc7a2592c13bc6bdc175551f075d (patch)
tree13baeb0d83a7c2a4c6299993c182b1227c2f6114 /test/tcoords.c
parent29ab58b58dce556639ea3154e262895773a8a8df (diff)
downloadhdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2
Clang-format of source files
Diffstat (limited to 'test/tcoords.c')
-rw-r--r--test/tcoords.c392
1 files changed, 185 insertions, 207 deletions
diff --git a/test/tcoords.c b/test/tcoords.c
index f639d4b..e92bdde 100644
--- a/test/tcoords.c
+++ b/test/tcoords.c
@@ -12,25 +12,25 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: tcoords
-*
-* Test the element coordinates for dataspace selection. For
-* chunked dataset, when the hyperslab selection of some
-* dimensions is full, the library optimize it by "flattenning"
-* the fully selected dimensions. This program tests if the
-* coordinates of selected elements are correctly calculated.
-*
-*************************************************************/
+ *
+ * Test program: tcoords
+ *
+ * Test the element coordinates for dataspace selection. For
+ * chunked dataset, when the hyperslab selection of some
+ * dimensions is full, the library optimize it by "flattenning"
+ * the fully selected dimensions. This program tests if the
+ * coordinates of selected elements are correctly calculated.
+ *
+ *************************************************************/
#include "testhdf5.h"
-#define FILENAME "coord.h5"
+#define FILENAME "coord.h5"
-#define SINGLE_END_DSET "single_end_dset"
-#define MULTI_ENDS_SEL_HYPER_DSET "multiple_ends_dset"
+#define SINGLE_END_DSET "single_end_dset"
+#define MULTI_ENDS_SEL_HYPER_DSET "multiple_ends_dset"
-#define NAME_LEN 128
+#define NAME_LEN 128
/* Data written to the dataset for single block test. Global variable
* for convenience. */
@@ -42,63 +42,37 @@ int da_buffer[2][3][6][2];
** one block.
**
*************************************************************/
-static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
+static void
+test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
{
- hid_t sid, plid, did, msid;
- char dset_name[NAME_LEN]; /* Dataset name */
- size_t elmts_numb;
- herr_t ret; /* Generic error return */
- int i, j, k;
- hsize_t da_dims[4] = { 2, 3, 6, 2 };
- hsize_t da_chunksize[4] = { 1, 3, 3, 2 };
+ hid_t sid, plid, did, msid;
+ char dset_name[NAME_LEN]; /* Dataset name */
+ size_t elmts_numb;
+ herr_t ret; /* Generic error return */
+ int i, j, k;
+ hsize_t da_dims[4] = {2, 3, 6, 2};
+ hsize_t da_chunksize[4] = {1, 3, 3, 2};
/* For testing the full selection in the fastest-growing end */
- int mem1_buffer[1][1][6][2];
- hsize_t mem1_dims[4] = { 1, 1, 6, 2 };
- hsize_t da_elmts1[12][4] = { {0, 0, 0, 0},
- {0, 0, 0, 1},
- {0, 0, 1, 0},
- {0, 0, 1, 1},
- {0, 0, 2, 0},
- {0, 0, 2, 1},
- {0, 0, 3, 0},
- {0, 0, 3, 1},
- {0, 0, 4, 0},
- {0, 0, 4, 1},
- {0, 0, 5, 0},
- {0, 0, 5, 1} };
+ int mem1_buffer[1][1][6][2];
+ hsize_t mem1_dims[4] = {1, 1, 6, 2};
+ hsize_t da_elmts1[12][4] = {{0, 0, 0, 0}, {0, 0, 0, 1}, {0, 0, 1, 0}, {0, 0, 1, 1},
+ {0, 0, 2, 0}, {0, 0, 2, 1}, {0, 0, 3, 0}, {0, 0, 3, 1},
+ {0, 0, 4, 0}, {0, 0, 4, 1}, {0, 0, 5, 0}, {0, 0, 5, 1}};
/* For testing the full selection in the slowest-growing end */
- int mem2_buffer[2][3][1][1];
- hsize_t mem2_dims[4] = { 2, 3, 1, 1 };
- hsize_t da_elmts2[6][4] = { {0, 0, 0, 0},
- {0, 1, 0, 0},
- {0, 2, 0, 0},
- {1, 0, 0, 0},
- {1, 1, 0, 0},
- {1, 2, 0, 0} };
+ int mem2_buffer[2][3][1][1];
+ hsize_t mem2_dims[4] = {2, 3, 1, 1};
+ hsize_t da_elmts2[6][4] = {{0, 0, 0, 0}, {0, 1, 0, 0}, {0, 2, 0, 0},
+ {1, 0, 0, 0}, {1, 1, 0, 0}, {1, 2, 0, 0}};
/* For testing the full selection in the middle dimensions */
- int mem3_buffer[1][3][6][1];
- hsize_t mem3_dims[4] = { 1, 3, 6, 1 };
- hsize_t da_elmts3[18][4] = { {0, 0, 0, 0},
- {0, 0, 1, 0},
- {0, 0, 2, 0},
- {0, 0, 3, 0},
- {0, 0, 4, 0},
- {0, 0, 5, 0},
- {0, 1, 0, 0},
- {0, 1, 1, 0},
- {0, 1, 2, 0},
- {0, 1, 3, 0},
- {0, 1, 4, 0},
- {0, 1, 5, 0},
- {0, 2, 0, 0},
- {0, 2, 1, 0},
- {0, 2, 2, 0},
- {0, 2, 3, 0},
- {0, 2, 4, 0},
- {0, 2, 5, 0} };
+ int mem3_buffer[1][3][6][1];
+ hsize_t mem3_dims[4] = {1, 3, 6, 1};
+ hsize_t da_elmts3[18][4] = {{0, 0, 0, 0}, {0, 0, 1, 0}, {0, 0, 2, 0}, {0, 0, 3, 0}, {0, 0, 4, 0},
+ {0, 0, 5, 0}, {0, 1, 0, 0}, {0, 1, 1, 0}, {0, 1, 2, 0}, {0, 1, 3, 0},
+ {0, 1, 4, 0}, {0, 1, 5, 0}, {0, 2, 0, 0}, {0, 2, 1, 0}, {0, 2, 2, 0},
+ {0, 2, 3, 0}, {0, 2, 4, 0}, {0, 2, 5, 0}};
/* Create and write the dataset */
sid = H5Screate_simple(4, da_dims, da_dims);
@@ -107,7 +81,7 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
plid = H5Pcreate(H5P_DATASET_CREATE);
CHECK(plid, FAIL, "H5Pcreate");
- if(is_chunked) {
+ if (is_chunked) {
ret = H5Pset_chunk(plid, 4, da_chunksize);
CHECK(ret, FAIL, "H5Pset_chunk");
}
@@ -115,18 +89,18 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
/* Construct dataset's name */
memset(dset_name, 0, (size_t)NAME_LEN);
strcat(dset_name, SINGLE_END_DSET);
- if(is_chunked)
+ if (is_chunked)
strcat(dset_name, "_chunked");
did = H5Dcreate2(file, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, plid, H5P_DEFAULT);
CHECK(did, FAIL, "H5Dcreate2");
/* Initialize the data to be written to file */
- for(i=0; i<2; i++) {
- for(j=0; j<3; j++) {
- for(k=0; k<6; k++) {
- da_buffer[i][j][k][0] = i*100 + j*10 + k;
- da_buffer[i][j][k][1] = i*100 + j*10 + k + 1;
+ for (i = 0; i < 2; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 6; k++) {
+ da_buffer[i][j][k][0] = i * 100 + j * 10 + k;
+ da_buffer[i][j][k][1] = i * 100 + j * 10 + k + 1;
}
}
}
@@ -137,7 +111,6 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
ret = H5Dclose(did);
CHECK(ret, FAIL, "H5Dclose");
-
/* ****** Case 1: ******
* Testing the full selection in the fastest-growing end */
did = H5Dopen2(file, dset_name, H5P_DEFAULT);
@@ -165,9 +138,9 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<6; i++)
- for(j=0; j<2; j++)
- if(da_buffer[0][0][i][j] != mem1_buffer[0][0][i][j]) {
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 2; j++)
+ if (da_buffer[0][0][i][j] != mem1_buffer[0][0][i][j]) {
TestErrPrintf("%u: Read different values than written at index 0,0,%d,%d\n", __LINE__, i, j);
}
@@ -198,10 +171,12 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<2; i++)
- for(j=0; j<3; j++)
- if(da_buffer[i][j][0][0] != mem2_buffer[i][j][0][0]) {
- TestErrPrintf("%u: Read different values than written at index %d,%d,0,0, da_buffer = %d, mem2_buffer = %d\n", __LINE__, i, j, da_buffer[i][j][0][0], mem2_buffer[i][j][0][0]);
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 3; j++)
+ if (da_buffer[i][j][0][0] != mem2_buffer[i][j][0][0]) {
+ TestErrPrintf("%u: Read different values than written at index %d,%d,0,0, da_buffer = %d, "
+ "mem2_buffer = %d\n",
+ __LINE__, i, j, da_buffer[i][j][0][0], mem2_buffer[i][j][0][0]);
}
/* ****** Case 3: ******
@@ -231,13 +206,12 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<3; i++)
- for(j=0; j<6; j++)
- if(da_buffer[0][i][j][0] != mem3_buffer[0][i][j][0]) {
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 6; j++)
+ if (da_buffer[0][i][j][0] != mem3_buffer[0][i][j][0]) {
TestErrPrintf("%u: Read different values than written at index 0,%d,%d,0\n", __LINE__, i, j);
}
-
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -251,42 +225,43 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
** of only one block.
**
*************************************************************/
-static void test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked)
+static void
+test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked)
{
- hid_t sid, did, msid;
- char dset_name[NAME_LEN]; /* Dataset name */
- herr_t ret; /* Generic error return */
- int i, j;
- hsize_t da_dims[4] = { 2, 3, 6, 2 };
+ hid_t sid, did, msid;
+ char dset_name[NAME_LEN]; /* Dataset name */
+ herr_t ret; /* Generic error return */
+ int i, j;
+ hsize_t da_dims[4] = {2, 3, 6, 2};
/* For testing the full selection in the fastest-growing end */
- int mem1_buffer[1][1][6][2];
- hsize_t mem1_dims[4] = { 1, 1, 6, 2 };
- hsize_t mem1_start[4] = { 0, 0, 0, 0 };
- hsize_t mem1_count[4] = { 1, 1, 1, 1 };
- hsize_t mem1_stride[4] = { 1, 1, 1, 1 };
- hsize_t mem1_block[4] = { 1, 1, 6, 2 };
+ int mem1_buffer[1][1][6][2];
+ hsize_t mem1_dims[4] = {1, 1, 6, 2};
+ hsize_t mem1_start[4] = {0, 0, 0, 0};
+ hsize_t mem1_count[4] = {1, 1, 1, 1};
+ hsize_t mem1_stride[4] = {1, 1, 1, 1};
+ hsize_t mem1_block[4] = {1, 1, 6, 2};
/* For testing the full selection in the slowest-growing end */
- int mem2_buffer[2][3][1][1];
- hsize_t mem2_dims[4] = { 2, 3, 1, 1 };
- hsize_t mem2_start[4] = { 0, 0, 0, 0 };
- hsize_t mem2_count[4] = { 1, 1, 1, 1 };
- hsize_t mem2_stride[4] = { 1, 1, 1, 1 };
- hsize_t mem2_block[4] = { 2, 3, 1, 1 };
+ int mem2_buffer[2][3][1][1];
+ hsize_t mem2_dims[4] = {2, 3, 1, 1};
+ hsize_t mem2_start[4] = {0, 0, 0, 0};
+ hsize_t mem2_count[4] = {1, 1, 1, 1};
+ hsize_t mem2_stride[4] = {1, 1, 1, 1};
+ hsize_t mem2_block[4] = {2, 3, 1, 1};
/* For testing the full selection in the middle dimensions */
- int mem3_buffer[1][3][6][1];
- hsize_t mem3_dims[4] = { 1, 3, 6, 1 };
- hsize_t mem3_start[4] = { 0, 0, 0, 0 };
- hsize_t mem3_count[4] = { 1, 1, 1, 1 };
- hsize_t mem3_stride[4] = { 1, 1, 1, 1 };
- hsize_t mem3_block[4] = { 1, 3, 6, 1 };
+ int mem3_buffer[1][3][6][1];
+ hsize_t mem3_dims[4] = {1, 3, 6, 1};
+ hsize_t mem3_start[4] = {0, 0, 0, 0};
+ hsize_t mem3_count[4] = {1, 1, 1, 1};
+ hsize_t mem3_stride[4] = {1, 1, 1, 1};
+ hsize_t mem3_block[4] = {1, 3, 6, 1};
/* Construct dataset's name */
memset(dset_name, 0, NAME_LEN);
strcat(dset_name, SINGLE_END_DSET);
- if(is_chunked)
+ if (is_chunked)
strcat(dset_name, "_chunked");
/* Dataspace for the dataset in file */
@@ -318,9 +293,9 @@ static void test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<6; i++)
- for(j=0; j<2; j++)
- if(da_buffer[0][0][i][j] != mem1_buffer[0][0][i][j]) {
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 2; j++)
+ if (da_buffer[0][0][i][j] != mem1_buffer[0][0][i][j]) {
TestErrPrintf("%u: Read different values than written at index 0,0,%d,%d\n", __LINE__, i, j);
}
@@ -349,9 +324,9 @@ static void test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<2; i++)
- for(j=0; j<3; j++)
- if(da_buffer[i][j][0][0] != mem2_buffer[i][j][0][0]) {
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 3; j++)
+ if (da_buffer[i][j][0][0] != mem2_buffer[i][j][0][0]) {
TestErrPrintf("%u: Read different values than written at index %d,%d,0,0\n", __LINE__, i, j);
}
@@ -380,75 +355,73 @@ static void test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<3; i++)
- for(j=0; j<6; j++)
- if(da_buffer[0][i][j][0] != mem3_buffer[0][i][j][0]) {
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 6; j++)
+ if (da_buffer[0][i][j][0] != mem3_buffer[0][i][j][0]) {
TestErrPrintf("%u: Read different values than written at index 0,%d,%d,0\n", __LINE__, i, j);
}
-
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
}
-
-
/***********************************************************
**
** test_multiple_end(): Test full hyperslab selection of
** multiple blocks.
**
*************************************************************/
-static void test_multiple_ends(hid_t file, hbool_t is_chunked)
+static void
+test_multiple_ends(hid_t file, hbool_t is_chunked)
{
- hid_t sid, plid, did, msid;
- char dset_name[NAME_LEN]; /* Dataset name */
- herr_t ret; /* Generic error return */
- int i, j, k, l, m, n, p;
- hsize_t da_dims[8] = { 4, 5, 3, 4, 2, 3, 6, 2 };
- hsize_t da_chunksize[8] = { 1, 5, 3, 2, 2, 3, 3, 2 };
- int data_buf[4][5][3][4][2][3][6][2];
+ hid_t sid, plid, did, msid;
+ char dset_name[NAME_LEN]; /* Dataset name */
+ herr_t ret; /* Generic error return */
+ int i, j, k, l, m, n, p;
+ hsize_t da_dims[8] = {4, 5, 3, 4, 2, 3, 6, 2};
+ hsize_t da_chunksize[8] = {1, 5, 3, 2, 2, 3, 3, 2};
+ int data_buf[4][5][3][4][2][3][6][2];
/* For testing the full selections in the fastest-growing end and in the middle dimensions */
- int mem1_buffer[1][1][1][4][2][1][6][2];
- hsize_t mem1_dims[8] = { 1, 1, 1, 4, 2, 1, 6, 2 };
- hsize_t mem1_start[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- hsize_t mem1_count[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem1_stride[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem1_block[8] = { 1, 1, 1, 4, 2, 1, 6, 2 };
+ int mem1_buffer[1][1][1][4][2][1][6][2];
+ hsize_t mem1_dims[8] = {1, 1, 1, 4, 2, 1, 6, 2};
+ hsize_t mem1_start[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+ hsize_t mem1_count[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem1_stride[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem1_block[8] = {1, 1, 1, 4, 2, 1, 6, 2};
/* For testing the full selections in the slowest-growing end and in the middle dimensions */
- int mem2_buffer[4][5][1][4][2][1][1][1];
- hsize_t mem2_dims[8] = { 4, 5, 1, 4, 2, 1, 1, 1 };
- hsize_t mem2_start[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- hsize_t mem2_count[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem2_stride[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem2_block[8] = { 4, 5, 1, 4, 2, 1, 1, 1 };
+ int mem2_buffer[4][5][1][4][2][1][1][1];
+ hsize_t mem2_dims[8] = {4, 5, 1, 4, 2, 1, 1, 1};
+ hsize_t mem2_start[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+ hsize_t mem2_count[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem2_stride[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem2_block[8] = {4, 5, 1, 4, 2, 1, 1, 1};
/* For testing two unadjacent full selections in the middle dimensions */
- int mem3_buffer[1][5][3][1][1][3][6][1];
- hsize_t mem3_dims[8] = { 1, 5, 3, 1, 1, 3, 6, 1 };
- hsize_t mem3_start[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- hsize_t mem3_count[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem3_stride[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem3_block[8] = { 1, 5, 3, 1, 1, 3, 6, 1 };
+ int mem3_buffer[1][5][3][1][1][3][6][1];
+ hsize_t mem3_dims[8] = {1, 5, 3, 1, 1, 3, 6, 1};
+ hsize_t mem3_start[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+ hsize_t mem3_count[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem3_stride[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem3_block[8] = {1, 5, 3, 1, 1, 3, 6, 1};
/* For testing the full selections in the fastest-growing end and the slowest-growing end */
- int mem4_buffer[4][5][1][1][1][1][6][2];
- hsize_t mem4_dims[8] = { 4, 5, 1, 1, 1, 1, 6, 2 };
- hsize_t mem4_start[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- hsize_t mem4_count[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem4_stride[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem4_block[8] = { 4, 5, 1, 1, 1, 1, 6, 2 };
+ int mem4_buffer[4][5][1][1][1][1][6][2];
+ hsize_t mem4_dims[8] = {4, 5, 1, 1, 1, 1, 6, 2};
+ hsize_t mem4_start[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+ hsize_t mem4_count[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem4_stride[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem4_block[8] = {4, 5, 1, 1, 1, 1, 6, 2};
/* For testing the full selections in the fastest-growing end and slowest-growing end,
* also in the middle dimensions */
- int mem5_buffer[4][5][1][4][2][1][6][2];
- hsize_t mem5_dims[8] = { 4, 5, 1, 4, 2, 1, 6, 2 };
- hsize_t mem5_start[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- hsize_t mem5_count[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem5_stride[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
- hsize_t mem5_block[8] = { 4, 5, 1, 4, 2, 1, 6, 2 };
+ int mem5_buffer[4][5][1][4][2][1][6][2];
+ hsize_t mem5_dims[8] = {4, 5, 1, 4, 2, 1, 6, 2};
+ hsize_t mem5_start[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+ hsize_t mem5_count[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem5_stride[8] = {1, 1, 1, 1, 1, 1, 1, 1};
+ hsize_t mem5_block[8] = {4, 5, 1, 4, 2, 1, 6, 2};
/* Create and write the dataset */
sid = H5Screate_simple(8, da_dims, da_dims);
@@ -457,7 +430,7 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
plid = H5Pcreate(H5P_DATASET_CREATE);
CHECK(plid, FAIL, "H5Pcreate");
- if(is_chunked) {
+ if (is_chunked) {
ret = H5Pset_chunk(plid, 8, da_chunksize);
CHECK(ret, FAIL, "H5Pset_chunk");
}
@@ -465,21 +438,23 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
/* Construct dataset's name */
memset(dset_name, 0, NAME_LEN);
strcat(dset_name, MULTI_ENDS_SEL_HYPER_DSET);
- if(is_chunked)
+ if (is_chunked)
strcat(dset_name, "_chunked");
did = H5Dcreate2(file, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, plid, H5P_DEFAULT);
CHECK(did, FAIL, "H5Dcreate2");
- for(i=0; i<4; i++)
- for(j=0; j<5; j++)
- for(k=0; k<3; k++)
- for(l=0; l<4; l++)
- for(m=0; m<2; m++)
- for(n=0; n<3; n++)
- for(p=0; p<6; p++) {
- data_buf[i][j][k][l][m][n][p][0] = i*1000000 + j*100000 + k*10000 + l*1000 + m*100 + n*10 + p;
- data_buf[i][j][k][l][m][n][p][1] = i*1000000 + j*100000 + k*10000 + l*1000 + m*100 + n*10 + p + 1;
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 5; j++)
+ for (k = 0; k < 3; k++)
+ for (l = 0; l < 4; l++)
+ for (m = 0; m < 2; m++)
+ for (n = 0; n < 3; n++)
+ for (p = 0; p < 6; p++) {
+ data_buf[i][j][k][l][m][n][p][0] =
+ i * 1000000 + j * 100000 + k * 10000 + l * 1000 + m * 100 + n * 10 + p;
+ data_buf[i][j][k][l][m][n][p][1] = i * 1000000 + j * 100000 + k * 10000 +
+ l * 1000 + m * 100 + n * 10 + p + 1;
}
ret = H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data_buf);
@@ -512,12 +487,13 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<4; i++)
- for(j=0; j<2; j++)
- for(k=0; k<6; k++)
- for(l=0; l<2; l++)
- if(data_buf[0][0][0][i][j][0][k][l] != mem1_buffer[0][0][0][i][j][0][k][l]) {
- TestErrPrintf("%u: Read different values than written at index 0,0,0,%d,%d,0,%d,%d\n", __LINE__, i, j, k, l);
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 2; j++)
+ for (k = 0; k < 6; k++)
+ for (l = 0; l < 2; l++)
+ if (data_buf[0][0][0][i][j][0][k][l] != mem1_buffer[0][0][0][i][j][0][k][l]) {
+ TestErrPrintf("%u: Read different values than written at index 0,0,0,%d,%d,0,%d,%d\n",
+ __LINE__, i, j, k, l);
}
/* ****** Case 2: ******
@@ -544,12 +520,13 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<4; i++)
- for(j=0; j<5; j++)
- for(k=0; k<4; k++)
- for(l=0; l<2; l++)
- if(data_buf[i][j][0][k][l][0][0][0] != mem2_buffer[i][j][0][k][l][0][0][0]) {
- TestErrPrintf("%u: Read different values than written at index %d,%d,0,%d,%d,0,0,0\n", __LINE__, i, j, k, l);
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 5; j++)
+ for (k = 0; k < 4; k++)
+ for (l = 0; l < 2; l++)
+ if (data_buf[i][j][0][k][l][0][0][0] != mem2_buffer[i][j][0][k][l][0][0][0]) {
+ TestErrPrintf("%u: Read different values than written at index %d,%d,0,%d,%d,0,0,0\n",
+ __LINE__, i, j, k, l);
}
/* ****** Case 3: ******
@@ -576,12 +553,13 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<5; i++)
- for(j=0; j<3; j++)
- for(k=0; k<3; k++)
- for(l=0; l<6; l++)
- if(data_buf[0][i][j][0][0][k][l][0] != mem3_buffer[0][i][j][0][0][k][l][0]) {
- TestErrPrintf("%u: Read different values than written at index 0,%d,%d,0,0,%d,%d,0\n", __LINE__, i, j, k, l);
+ for (i = 0; i < 5; i++)
+ for (j = 0; j < 3; j++)
+ for (k = 0; k < 3; k++)
+ for (l = 0; l < 6; l++)
+ if (data_buf[0][i][j][0][0][k][l][0] != mem3_buffer[0][i][j][0][0][k][l][0]) {
+ TestErrPrintf("%u: Read different values than written at index 0,%d,%d,0,0,%d,%d,0\n",
+ __LINE__, i, j, k, l);
}
/* ****** Case 4: ******
@@ -608,15 +586,15 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<4; i++)
- for(j=0; j<5; j++)
- for(k=0; k<6; k++)
- for(l=0; l<2; l++)
- if(data_buf[i][j][0][0][0][0][k][l] != mem4_buffer[i][j][0][0][0][0][k][l]) {
- TestErrPrintf("%u: Read different values than written at index %d,%d,0,0,0,0,%d,%d\n", __LINE__, i, j, k, l);
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 5; j++)
+ for (k = 0; k < 6; k++)
+ for (l = 0; l < 2; l++)
+ if (data_buf[i][j][0][0][0][0][k][l] != mem4_buffer[i][j][0][0][0][0][k][l]) {
+ TestErrPrintf("%u: Read different values than written at index %d,%d,0,0,0,0,%d,%d\n",
+ __LINE__, i, j, k, l);
}
-
/* ****** Case 5: ******
* Testing the full selections in the fastest-growing end and the slowest-growing end,
* and also in the middle dimensions */
@@ -642,17 +620,18 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
ret = H5Sclose(msid);
CHECK(ret, FAIL, "H5Sclose");
- for(i=0; i<4; i++)
- for(j=0; j<5; j++)
- for(k=0; k<4; k++)
- for(l=0; l<2; l++)
- for(m=0; m<6; m++)
- for(n=0; n<2; n++)
- if(data_buf[i][j][0][k][l][0][m][n] != mem5_buffer[i][j][0][k][l][0][m][n]) {
- TestErrPrintf("%u: Read different values than written at index %d,%d,0,%d,%d,0,%d,%d\n", __LINE__, i, j, k, l, m, n);
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 5; j++)
+ for (k = 0; k < 4; k++)
+ for (l = 0; l < 2; l++)
+ for (m = 0; m < 6; m++)
+ for (n = 0; n < 2; n++)
+ if (data_buf[i][j][0][k][l][0][m][n] != mem5_buffer[i][j][0][k][l][0][m][n]) {
+ TestErrPrintf(
+ "%u: Read different values than written at index %d,%d,0,%d,%d,0,%d,%d\n",
+ __LINE__, i, j, k, l, m, n);
}
-
ret = H5Sclose(sid);
CHECK(ret, FAIL, "H5Sclose");
@@ -660,18 +639,18 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
CHECK(ret, FAIL, "H5Pclose");
}
-
/****************************************************************
**
** test_coords(): Main testing routine.
**
****************************************************************/
-void test_coords(void)
+void
+test_coords(void)
{
hid_t fid;
hbool_t is_chunk[2] = {TRUE, FALSE};
int i;
- herr_t ret; /* Generic error return */
+ herr_t ret; /* Generic error return */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fcreate");
@@ -691,7 +670,6 @@ void test_coords(void)
CHECK(ret, FAIL, "H5Fclose");
}
-
/*-------------------------------------------------------------------------
* Function: cleanup_coords
*