summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2022-03-12 15:36:07 (GMT)
committerGitHub <noreply@github.com>2022-03-12 15:36:07 (GMT)
commita1de01d07eb069dcc342fa4238a05e2489d7f009 (patch)
treeda96aae04357944d3b16a56fb2ff9b6f751322cd /test
parent540edb0e3fad29cde825ca05d964d214b188ccbc (diff)
downloadhdf5-a1de01d07eb069dcc342fa4238a05e2489d7f009.zip
hdf5-a1de01d07eb069dcc342fa4238a05e2489d7f009.tar.gz
hdf5-a1de01d07eb069dcc342fa4238a05e2489d7f009.tar.bz2
Implemented suggestion in #1381 for dtransform test (#1491)
Diffstat (limited to 'test')
-rw-r--r--test/dtransform.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/test/dtransform.c b/test/dtransform.c
index 743103f..33cf3b7 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -122,9 +122,8 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22,
{ \
TYPE array[ROWS][COLS]; \
const char *f_to_c = "(5/9.0)*(x-32)"; \
- /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to \
- * fit into uchar */ \
- const char *utrans = "((x+100)/4)*3"; \
+ /* utrans is a transform for char types: numbers are restricted from -128 to 127, fits into char */ \
+ const char *utrans = "(x/4+25)*3"; \
\
hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, dset, dset_nn, dt_nn; \
H5T_order_t order; \
@@ -199,6 +198,8 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22,
COMPARE(TYPE, array, COMPARE_DATA, 2) \
} \
\
+ if (H5Dclose(dset_nn) < 0) \
+ TEST_ERROR; \
if (H5Dclose(dset) < 0) \
TEST_ERROR; \
if (H5Sclose(dataspace) < 0) \
@@ -209,9 +210,8 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22,
{ \
TYPE array[ROWS][COLS]; \
const char *f_to_c = "(5/9.0)*(x-32)"; \
- /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to \
- * fit into uchar */ \
- const char *utrans = "((x+100)/4)*3"; \
+ /* utrans is a transform for char types: numbers are restricted from -128 to 127, fits into char */ \
+ const char *utrans = "(x/4+25)*3"; \
\
hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, memspace, dset_chunk, filespace; \
hsize_t dim[2] = {ROWS, COLS}; \
@@ -312,7 +312,7 @@ main(void)
const char *simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
const char *polynomial = "(2+x)* ((x-8)/2)";
/* inverses the utrans transform in init_test to get back original array */
- const char *utrans_inv = "(x/3)*4 - 100";
+ const char *utrans_inv = "(x/3 - 25)*4";
if ((file_id = H5Fcreate("dtransform.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
@@ -438,9 +438,8 @@ static int
init_test(hid_t file_id)
{
const char *f_to_c = "(5/9.0)*(x-32)";
- /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to fit
- * into uchar */
- const char *utrans = "((x+100)/4)*3";
+ /* utrans is a transform for char types: numbers are restricted from -128 to 127, fits into char */
+ const char *utrans = "(x/4+25)*3";
hid_t dataspace = -1;
hid_t dxpl_id_f_to_c = -1;
@@ -467,7 +466,7 @@ init_test(hid_t file_id)
if ((dataspace = H5Screate_simple(2, dim, NULL)) < 0)
TEST_ERROR
- TESTING("Intializing test...")
+ TESTING("Initializing test...")
if ((dset_id_int = H5Dcreate2(file_id, "/default_int", H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
H5P_DEFAULT, H5P_DEFAULT)) < 0)