From c9347450c11edc8d73542a6244333d04f3462045 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 4 Feb 2022 16:50:45 -0600 Subject: Implemented suggestion in #1381 for dtransform test (#1415) * Implemented suggestion in #1380 * fix typo * Use differently named files in tests * format fix * Revise comments * fic typos * Change test display and file name --- c++/test/titerate.cpp | 7 ++++++- test/dtransform.c | 17 +++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index bc4d892..57761ea 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -351,7 +351,7 @@ test_iter_group(FileAccPropList &fapl) * Purpose Open an attribute and verify that it has a the correct name *------------------------------------------------------------------------- */ -const H5std_string FILE_NAME("titerate.h5"); +const H5std_string FILE_NAME("test_member_access.h5"); const H5std_string GRP_NAME("/Group_A"); const H5std_string FDATASET_NAME("file dset"); const H5std_string GDATASET_NAME("group dset"); @@ -396,6 +396,9 @@ test_HDFFV_9920() int attr_data[2] = {100, 200}; hsize_t dims[1] = {DIM1}; + /* Output message about test being performed */ + SUBTEST("Member access"); + try { // Create a new file and a group in it H5File file(FILE_NAME, H5F_ACC_TRUNC); @@ -425,6 +428,7 @@ test_HDFFV_9920() printelems(file, FDATASET_NAME, FATTR_NAME); printelems(gr1, GDATASET_NAME, GATTR_NAME); + PASSED(); } // end of try block // Catch all failures for handling in the same way @@ -473,4 +477,5 @@ extern "C" void cleanup_iterate() { HDremove(FILE_ITERATE.c_str()); + HDremove(FILE_NAME.c_str()); } // cleanup_iterate diff --git a/test/dtransform.c b/test/dtransform.c index 9f7e659..1f6d48b 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; \ @@ -211,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}; \ @@ -314,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; @@ -436,9 +434,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; -- cgit v0.12