diff options
Diffstat (limited to 'test/dtransform.c')
-rw-r--r-- | test/dtransform.c | 206 |
1 files changed, 103 insertions, 103 deletions
diff --git a/test/dtransform.c b/test/dtransform.c index 52e8b03..84e00cc 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -142,16 +142,16 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, TEST_ERROR; \ \ if ((dt_nn = H5Tcopy(HDF_TYPE)) < 0) \ - TEST_ERROR \ + TEST_ERROR; \ if ((order = H5Tget_order(dt_nn)) == H5T_ORDER_ERROR) \ - TEST_ERROR \ + TEST_ERROR; \ if (H5Tset_order(dt_nn, order == H5T_ORDER_LE ? H5T_ORDER_BE : H5T_ORDER_LE) < 0) \ - TEST_ERROR \ + TEST_ERROR; \ if ((dset_nn = H5Dcreate2(file_id, "/nonnative_transformtest_" TEST_STR, dt_nn, dataspace, \ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) \ - TEST_ERROR \ + TEST_ERROR; \ if (H5Tclose(dt_nn) < 0) \ - TEST_ERROR \ + TEST_ERROR; \ \ if (SIGNED) { \ if ((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0) \ @@ -178,7 +178,7 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, TEST_ERROR; \ } \ \ - TESTING("contiguous, no data type conversion (" TEST_STR "->" TEST_STR ")") \ + TESTING("contiguous, no data type conversion (" TEST_STR "->" TEST_STR ")"); \ \ if (H5Dread(dset, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) \ TEST_ERROR; \ @@ -187,7 +187,7 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, else \ UCOMPARE(TYPE, array->arr, COMPARE_DATA, 4) \ \ - TESTING("contiguous, byte order conversion (" TEST_STR "->" TEST_STR ")") \ + TESTING("contiguous, byte order conversion (" TEST_STR "->" TEST_STR ")"); \ \ if (H5Dread(dset_nn, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) \ TEST_ERROR; \ @@ -197,7 +197,7 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, UCOMPARE(TYPE, array->arr, COMPARE_DATA, 4) \ \ if (SIGNED) { \ - TESTING("contiguous, with type conversion (float->" TEST_STR ")") \ + TESTING("contiguous, with type conversion (float->" TEST_STR ")"); \ \ if (H5Dread(dset_id_float, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) \ TEST_ERROR; \ @@ -243,9 +243,9 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) \ TEST_ERROR; \ if ((filespace = H5Dget_space(dset_chunk)) < 0) \ - TEST_ERROR \ + TEST_ERROR; \ if ((memspace = H5Screate_simple(2, dim, NULL)) < 0) \ - TEST_ERROR \ + TEST_ERROR; \ if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0) \ TEST_ERROR; \ \ @@ -272,7 +272,7 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, TEST_ERROR; \ } \ \ - TESTING("chunked, no data type conversion (" TEST_STR "->" TEST_STR ")") \ + TESTING("chunked, no data type conversion (" TEST_STR "->" TEST_STR ")"); \ \ if (H5Dread(dset_chunk, HDF_TYPE, memspace, filespace, XFORM, array) < 0) \ TEST_ERROR; \ @@ -282,7 +282,7 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, UCOMPARE(TYPE, array->arr, COMPARE_DATA, 4) \ \ if (SIGNED) { \ - TESTING("chunked, with type conversion (float->" TEST_STR ")") \ + TESTING("chunked, with type conversion (float->" TEST_STR ")"); \ \ if (H5Dread(dset_id_float_chunk, HDF_TYPE, memspace, filespace, XFORM, array) < 0) \ TEST_ERROR; \ @@ -462,65 +462,65 @@ init_test(hid_t file_id) hsize_t offset[2] = {0, 0}; if ((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0) - TEST_ERROR + TEST_ERROR; if ((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0) - TEST_ERROR + TEST_ERROR; if (H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0) - TEST_ERROR + TEST_ERROR; if (H5Pset_data_transform(dxpl_id_utrans, utrans) < 0) - TEST_ERROR + TEST_ERROR; cparms = H5Pcreate(H5P_DATASET_CREATE); if (H5Pset_chunk(cparms, 2, dim) < 0) - TEST_ERROR + TEST_ERROR; if ((dataspace = H5Screate_simple(2, dim, NULL)) < 0) - TEST_ERROR + TEST_ERROR; - TESTING("Initializing test...") + TESTING("Initializing test..."); if ((dset_id_int = H5Dcreate2(file_id, "/default_int", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dwrite(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) - TEST_ERROR + TEST_ERROR; if ((dset_id_float = H5Dcreate2(file_id, "/default_float", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dwrite(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) - TEST_ERROR + TEST_ERROR; if ((dset_id_int_chunk = H5Dcreate2(file_id, "/default_chunk_int", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR; if ((filespace = H5Dget_space(dset_id_int_chunk)) < 0) - TEST_ERROR + TEST_ERROR; if (H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dwrite(dset_id_int_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat) < 0) - TEST_ERROR + TEST_ERROR; if ((dset_id_float_chunk = H5Dcreate2(file_id, "/default_chunk_float", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dwrite(dset_id_float_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat) < 0) - TEST_ERROR + TEST_ERROR; if (H5Pclose(cparms) < 0) - TEST_ERROR + TEST_ERROR; if (H5Pclose(dxpl_id_f_to_c) < 0) - TEST_ERROR + TEST_ERROR; if (H5Pclose(dxpl_id_utrans) < 0) - TEST_ERROR + TEST_ERROR; if (H5Sclose(dataspace) < 0) - TEST_ERROR + TEST_ERROR; if (H5Sclose(filespace) < 0) - TEST_ERROR + TEST_ERROR; PASSED(); @@ -555,9 +555,9 @@ test_poly(const hid_t dxpl_id_polynomial) polyflres[row][col] = ((2.0F + (float)windchillC) * (((float)windchillC - 8.0F) / 2.0F)); } - TESTING("data transform, polynomial transform (int->float)") + TESTING("data transform, polynomial transform (int->float)"); if (H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyflread) < 0) - TEST_ERROR + TEST_ERROR; COMPARE(float, polyflread, polyflres, 2.0F) @@ -567,9 +567,9 @@ test_poly(const hid_t dxpl_id_polynomial) polyflres[row][col] = (float)((2 + windchillC) * ((windchillC - 8) / 2)); } - TESTING("data transform, polynomial transform (float->int)") + TESTING("data transform, polynomial transform (float->int)"); if (H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyintread) < 0) - TEST_ERROR + TEST_ERROR; COMPARE(int, polyintread, polyflres, 4) @@ -595,10 +595,10 @@ test_specials(hid_t file) const char *special6 = "2e+1*x"; const char *special7 = "x"; - TESTING("data transform of some special cases") + TESTING("data transform of some special cases"); if ((dataspace = H5Screate_simple(2, dim, NULL)) < 0) - TEST_ERROR + TEST_ERROR; if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; @@ -615,16 +615,16 @@ test_specials(hid_t file) if ((dset_id = H5Dcreate2(file, "/special1", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, transformData) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) - TEST_ERROR + TEST_ERROR; COMPARE_INT(read_buf, data_res) if (H5Dclose(dset_id) < 0) - TEST_ERROR + TEST_ERROR; /*----------------------------- * Operation 2: 100-x @@ -638,16 +638,16 @@ test_specials(hid_t file) if ((dset_id = H5Dcreate2(file, "/special2", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, transformData) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) - TEST_ERROR + TEST_ERROR; COMPARE_INT(read_buf, data_res) if (H5Dclose(dset_id) < 0) - TEST_ERROR + TEST_ERROR; /*----------------------------- * Operation 3: 1000/x @@ -661,16 +661,16 @@ test_specials(hid_t file) if ((dset_id = H5Dcreate2(file, "/special3", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, transformData) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) - TEST_ERROR + TEST_ERROR; COMPARE_INT(read_buf, data_res) if (H5Dclose(dset_id) < 0) - TEST_ERROR + TEST_ERROR; /*----------------------------- * Operation 4: -x @@ -684,16 +684,16 @@ test_specials(hid_t file) if ((dset_id = H5Dcreate2(file, "/special4", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, transformData) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) - TEST_ERROR + TEST_ERROR; COMPARE_INT(read_buf, data_res) if (H5Dclose(dset_id) < 0) - TEST_ERROR + TEST_ERROR; /*----------------------------- * Operation 5: +x @@ -707,16 +707,16 @@ test_specials(hid_t file) if ((dset_id = H5Dcreate2(file, "/special5", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, transformData) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) - TEST_ERROR + TEST_ERROR; COMPARE_INT(read_buf, data_res) if (H5Dclose(dset_id) < 0) - TEST_ERROR + TEST_ERROR; /*----------------------------- * Operation 6: 2e+1*x @@ -730,16 +730,16 @@ test_specials(hid_t file) if ((dset_id = H5Dcreate2(file, "/special6", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, transformData) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) - TEST_ERROR + TEST_ERROR; COMPARE_INT(read_buf, data_res) if (H5Dclose(dset_id) < 0) - TEST_ERROR + TEST_ERROR; /*----------------------------- * Operation 7: x @@ -756,21 +756,21 @@ test_specials(hid_t file) if ((dset_id = H5Dcreate2(file, "/special7", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, transformData) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) - TEST_ERROR + TEST_ERROR; COMPARE_INT(read_buf, data_res) if (H5Dclose(dset_id) < 0) - TEST_ERROR + TEST_ERROR; if (H5Pclose(dxpl_id) < 0) - TEST_ERROR + TEST_ERROR; if (H5Sclose(dataspace) < 0) - TEST_ERROR + TEST_ERROR; PASSED(); return 0; @@ -794,15 +794,15 @@ test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_copy) polyflres[row][col] = (float)((2 + windchillC) * ((windchillC - 8) / 2)); } - TESTING("data transform, linear transform w/ copied property") + TESTING("data transform, linear transform w/ copied property"); if (H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f_copy, windchillFintread) < 0) - TEST_ERROR + TEST_ERROR; COMPARE(int, windchillFintread, windchillFfloat, 2) - TESTING("data transform, polynomial transform w/ copied property") + TESTING("data transform, polynomial transform w/ copied property"); if (H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial_copy, polyintread) < 0) - TEST_ERROR + TEST_ERROR; COMPARE(int, polyintread, polyflres, 2) @@ -819,9 +819,9 @@ test_trivial(const hid_t dxpl_id_simple) int windchillFintread[ROWS][COLS]; int row, col; - TESTING("data transform, trivial transform, without type conversion") + TESTING("data transform, trivial transform, without type conversion"); if (H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFfloatread) < 0) - TEST_ERROR + TEST_ERROR; for (row = 0; row < ROWS; row++) for (col = 0; col < COLS; col++) { if ((windchillFfloatread[row][col] - 4.8F) > FLOAT_TOL) @@ -830,13 +830,13 @@ test_trivial(const hid_t dxpl_id_simple) PASSED(); - TESTING("data transform, trivial transform, with type conversion") + TESTING("data transform, trivial transform, with type conversion"); if (H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFintread) < 0) - TEST_ERROR + TEST_ERROR; for (row = 0; row < ROWS; row++) for (col = 0; col < COLS; col++) { if (windchillFintread[row][col] != 4) - FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n") + FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n"); } PASSED(); @@ -856,45 +856,45 @@ test_getset(const hid_t dxpl_id_c_to_f) const char *c_to_f = "(9/5.0)*x + 32"; char * ptrgetTest = NULL; - TESTING("H5Pget_data_transform") + TESTING("H5Pget_data_transform"); if (NULL == (ptrgetTest = (char *)HDmalloc(HDstrlen(simple) + 1))) - TEST_ERROR + TEST_ERROR; if (H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(c_to_f) + 1) < 0) - TEST_ERROR + TEST_ERROR; if (HDstrcmp(c_to_f, ptrgetTest) != 0) - FAIL_PUTS_ERROR(" ERROR: Data transform failed to match what was set\n") + FAIL_PUTS_ERROR(" ERROR: Data transform failed to match what was set\n"); PASSED(); HDfree(ptrgetTest); ptrgetTest = NULL; - TESTING("data transform, read after resetting of transform property") + TESTING("data transform, read after resetting of transform property"); if (H5Pset_data_transform(dxpl_id_c_to_f, simple) < 0) - TEST_ERROR + TEST_ERROR; if (H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFfloatread) < 0) - TEST_ERROR + TEST_ERROR; for (row = 0; row < ROWS; row++) for (col = 0; col < COLS; col++) { if ((windchillFfloatread[row][col] - 4.8F) > FLOAT_TOL) - FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n") + FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n"); } PASSED(); - TESTING("H5Pget_data_transform, after resetting transform property") + TESTING("H5Pget_data_transform, after resetting transform property"); if (NULL == (ptrgetTest = (char *)HDcalloc((size_t)1, HDstrlen(simple) + 1))) - TEST_ERROR + TEST_ERROR; if (H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(simple) + 1) < 0) - TEST_ERROR + TEST_ERROR; if (HDstrcmp(simple, ptrgetTest) != 0) - FAIL_PUTS_ERROR(" ERROR: Data transform failed to match what was set\n") + FAIL_PUTS_ERROR(" ERROR: Data transform failed to match what was set\n"); PASSED(); @@ -918,13 +918,13 @@ test_set(void) const char *str = "(9/5.0)*x + 32"; char * ptrgetTest = NULL; - TESTING("H5Pget_data_transform (get before set)") + TESTING("H5Pget_data_transform (get before set)"); if (NULL == (ptrgetTest = (char *)HDmalloc(HDstrlen(str) + 1))) - TEST_ERROR + TEST_ERROR; if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) - TEST_ERROR + TEST_ERROR; /* Test get before set */ H5Eget_auto2(H5E_DEFAULT, &func, NULL); @@ -942,34 +942,34 @@ test_set(void) TESTING("H5Pset_data_transform (set with NULL transform)"); INVALID_SET_TEST(NULL); - TESTING("H5Pset_data_transform (set with invalid transform 1)") + TESTING("H5Pset_data_transform (set with invalid transform 1)"); INVALID_SET_TEST("\0"); - TESTING("H5Pset_data_transform (set with invalid transform 2)") + TESTING("H5Pset_data_transform (set with invalid transform 2)"); INVALID_SET_TEST(" "); - TESTING("H5Pset_data_transform (set with invalid transform 3)") + TESTING("H5Pset_data_transform (set with invalid transform 3)"); INVALID_SET_TEST("x+"); - TESTING("H5Pset_data_transform (set with invalid transform 4)") + TESTING("H5Pset_data_transform (set with invalid transform 4)"); INVALID_SET_TEST("(x+5"); - TESTING("H5Pset_data_transform (set with invalid transform 5)") + TESTING("H5Pset_data_transform (set with invalid transform 5)"); INVALID_SET_TEST("+"); - TESTING("H5Pset_data_transform (set with invalid transform 6)") + TESTING("H5Pset_data_transform (set with invalid transform 6)"); INVALID_SET_TEST("(9/5)*x + x**2"); - TESTING("H5Pset_data_transform (set with invalid transform 7)") + TESTING("H5Pset_data_transform (set with invalid transform 7)"); INVALID_SET_TEST("(9/5)x"); - TESTING("H5Pset_data_transform (set with invalid transform 8)") + TESTING("H5Pset_data_transform (set with invalid transform 8)"); INVALID_SET_TEST("(9/5)*x + x^2"); H5Eset_auto2(H5E_DEFAULT, func, NULL); if (H5Pclose(dxpl_id) < 0) - TEST_ERROR + TEST_ERROR; return 0; |