diff options
Diffstat (limited to 'hl/test')
-rw-r--r-- | hl/test/test_ds.c | 112 | ||||
-rw-r--r-- | hl/test/test_lite.c | 86 |
2 files changed, 99 insertions, 99 deletions
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 49dc72f..95178fc 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -186,11 +186,11 @@ int main(void) if(nerrors) goto error; - printf("All dimension scales tests passed.\n"); + HDprintf("All dimension scales tests passed.\n"); return 0; error: - printf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); + HDprintf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); return 1; } @@ -1110,7 +1110,7 @@ herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *sc if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) { if(H5DSis_attached(did, dsid, idx) == 1) { if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) { - name_out = (char*)HDmalloc(((size_t)name_len+1) * sizeof (char)); + name_out = (char*)HDmalloc(((size_t)name_len+1) * sizeof (char)); if(name_out != NULL) { if(H5DSget_scale_name(dsid, name_out, (size_t)name_len+1) >= 0) { if(HDstrncmp(scalename, name_out, (size_t)name_len)==0) { @@ -1156,7 +1156,7 @@ static int test_detachscales(void) sprintf(dname,"D%d", i); if(H5LTmake_dataset_int(fid, dname, rank3, dims, buf) < 0) goto out; - } + } /* create datasets and make them dim. scales */ for (i=0; i < 4; i++) { @@ -1164,11 +1164,11 @@ static int test_detachscales(void) if(H5LTmake_dataset_int(fid, dname, rank1, dims, buf) < 0) goto out; } - /* attach scales to the first dataset; first dimension will have + /* attach scales to the first dataset; first dimension will have two scales attached */ if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) { for (i=0; i<4; i++) { - sprintf(dname, "DS%d", i); + HDsprintf(dname, "DS%d", i); if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did, dsid, (unsigned int) i%3) < 0) @@ -1185,7 +1185,7 @@ static int test_detachscales(void) /* attach scales to the second dataset */ if((did = H5Dopen2(fid, "D1", H5P_DEFAULT)) >= 0) { for (i=0; i<3; i++) { - sprintf(dname, "DS%d", i); + HDsprintf(dname, "DS%d", i); if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did, dsid, (unsigned int) i) < 0) @@ -1206,20 +1206,20 @@ static int test_detachscales(void) goto out; for (i=0; i<2; i++) { - sprintf(dname, "D%d", i); + HDsprintf(dname, "D%d", i); if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSdetach_scale(did, dsid, (unsigned int)0) < 0) goto out; if(H5Dclose(did) < 0) goto out; - } + } /* Check that attribute "REFERENCE_LIST" doesn't exist anymore */ if(H5Aexists(dsid, REFERENCE_LIST)!= 0) goto out; if(H5Dclose(dsid) < 0) goto out; - /* Check that DS3 is the only dim. scale attached to the first + /* Check that DS3 is the only dim. scale attached to the first dimension of D0 */ if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) < 0) goto out; @@ -1232,11 +1232,11 @@ static int test_detachscales(void) if(H5Dclose(dsid) < 0) goto out; - /* Detach the rest of the scales DS3, DS1, DS2 from D0 and make + /* Detach the rest of the scales DS3, DS1, DS2 from D0 and make sure that attribute "DIMENSION_LIST" doesn't exist anymore */ if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) { for (i=1; i<4; i++) { - sprintf(dname, "DS%d", i); + HDsprintf(dname, "DS%d", i); if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSdetach_scale(did, dsid, (unsigned int) i%3) < 0) @@ -1253,7 +1253,7 @@ static int test_detachscales(void) else goto out; - + PASSED(); H5Fclose(fid); @@ -2873,10 +2873,10 @@ static int test_simple(void) if((sid = H5Screate_simple(rank,dims,NULL)) < 0) goto out; for(i = 0; i < 5; i++) { - sprintf(dname,"dset_%d",i); + HDsprintf(dname,"dset_%d",i); if((did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - sprintf(sname,"ds_%d",i); + HDsprintf(sname,"ds_%d",i); if((dsid = H5Dcreate2(gid, sname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5DSset_scale(dsid,"scale") < 0) @@ -2893,11 +2893,11 @@ static int test_simple(void) */ for(i = 0; i < 5; i++) { - sprintf(dname, "dset_%d", i); + HDsprintf(dname, "dset_%d", i); if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) goto out; for(j = 0; j < 5; j++) { - sprintf(sname, "ds_%d", j); + HDsprintf(sname, "ds_%d", j); if((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did, dsid, DIM0) < 0) @@ -2915,7 +2915,7 @@ static int test_simple(void) */ for(i = 0; i < 5; i++) { - sprintf(dname, "dset_%d", i); + HDsprintf(dname, "dset_%d", i); if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) goto out; for(j = 0; j < 5; j++) { @@ -2938,7 +2938,7 @@ static int test_simple(void) */ for(i=0; i<5; i++) { - sprintf(dname,"dset_%d",i); + HDsprintf(dname,"dset_%d",i); if((did = H5Dopen2(gid,dname, H5P_DEFAULT)) < 0) goto out; for(j=0; j<5; j++) { @@ -3541,7 +3541,7 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor for(i=0; i<nelmts; i++) { if(buf[i] != data[i]) { - printf("read and write buffers differ\n"); + HDprintf("read and write buffers differ\n"); goto out; } } @@ -5014,7 +5014,7 @@ static int test_errors2(void) goto out; if ((label_len=H5DSget_label(did,0,NULL,0)) < 0) goto out; - if ( label_len != strlen("label") ) + if ( label_len != HDstrlen("label") ) goto out; if (H5DSget_label(did,0,lbuf,sizeof(lbuf)) < 0) goto out; @@ -5134,83 +5134,83 @@ static int test_attach_detach(void) if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; - - if((sid = H5Screate_simple(1, dims, dims)) < 0) + + if((sid = H5Screate_simple(1, dims, dims)) < 0) goto out; if((dsid = H5Dcreate2(gid, DS_3_NAME, H5T_IEEE_F32BE, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) goto out; - if(H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; - if(H5Pclose(dcpl_id) < 0) + if(H5Pclose(dcpl_id) < 0) goto out; - if(H5DSset_scale(dsid, DS_3_NAME) < 0) + if(H5DSset_scale(dsid, DS_3_NAME) < 0) goto out; /* Create a variable that uses this dimension scale. */ - if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) + if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) goto out; if((var1_id = H5Dcreate2(gid, DS_31_NAME, H5T_NATIVE_FLOAT, sid, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; - if(H5DSattach_scale(var1_id, dsid, 0) < 0) + if(H5DSattach_scale(var1_id, dsid, 0) < 0) goto out; /* Create another variable that uses this dimension scale. */ - if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; - if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) + if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) goto out; - if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) + if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) goto out; if((var2_id = H5Dcreate2(gid, DS_32_NAME, H5T_NATIVE_FLOAT, sid, - H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) + H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) goto out; - if(H5Pclose(dcpl_id) < 0) + if(H5Pclose(dcpl_id) < 0) goto out; - if(H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; /* Create 3rd variable that uses this dimension scale. */ - if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; - if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) + if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0) goto out; - if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) + if((sid = H5Screate_simple(DIM1, dims, dims)) < 0) goto out; if((var3_id = H5Dcreate2(gid, DS_33_NAME, H5T_NATIVE_FLOAT, sid, - H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) + H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0) goto out; - if(H5Pclose(dcpl_id) < 0) + if(H5Pclose(dcpl_id) < 0) goto out; - if(H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; - + /* Attached var2 scale */ - if(H5DSattach_scale(var2_id, dsid, 0) < 0) + if(H5DSattach_scale(var2_id, dsid, 0) < 0) goto out; /* Detach the var2 scale */ - if(H5DSdetach_scale(var2_id, dsid, 0) < 0) + if(H5DSdetach_scale(var2_id, dsid, 0) < 0) goto out; /* Check if in correct state of detached and attached */ @@ -5220,7 +5220,7 @@ static int test_attach_detach(void) goto out; /* Detach the var1 scale */ - if(H5DSdetach_scale(var1_id, dsid, 0) < 0) + if(H5DSdetach_scale(var1_id, dsid, 0) < 0) goto out; /* Check if in correct state of detached and attached */ @@ -5231,10 +5231,10 @@ static int test_attach_detach(void) /* Attach the DS again and remove them in the opposite order */ - if(H5DSattach_scale(var1_id, dsid, 0) < 0) + if(H5DSattach_scale(var1_id, dsid, 0) < 0) goto out; - if(H5DSattach_scale(var2_id, dsid, 0) < 0) + if(H5DSattach_scale(var2_id, dsid, 0) < 0) goto out; /* Detach the var1 scale */ @@ -5262,13 +5262,13 @@ static int test_attach_detach(void) * Attach Three DS and remove the middle one first *****************************************************/ - if(H5DSattach_scale(var1_id, dsid, 0) < 0) + if(H5DSattach_scale(var1_id, dsid, 0) < 0) goto out; - if(H5DSattach_scale(var2_id, dsid, 0) < 0) + if(H5DSattach_scale(var2_id, dsid, 0) < 0) goto out; - if(H5DSattach_scale(var3_id, dsid, 0) < 0) + if(H5DSattach_scale(var3_id, dsid, 0) < 0) goto out; @@ -5314,15 +5314,15 @@ static int test_attach_detach(void) *------------------------------------------------------------------------- */ - if(H5Dclose(var1_id) < 0) + if(H5Dclose(var1_id) < 0) goto out; - if(H5Dclose(var2_id) < 0) + if(H5Dclose(var2_id) < 0) goto out; - if(H5Dclose(var3_id) < 0) + if(H5Dclose(var3_id) < 0) goto out; - if(H5Dclose(dsid) < 0) + if(H5Dclose(dsid) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; if(H5Fclose(fid) < 0) goto out; diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 763fdb5..51ab72b 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1050,7 +1050,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) HDfree( dims_out ); return -1; } - + for (i = 0; i < rank_out; i++) { if ( dims_out[i] != 5 ) { HDfree( dims_out ); @@ -1152,7 +1152,7 @@ static int test_fps(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { @@ -1228,7 +1228,7 @@ static int test_strings(void) goto out; } if(HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE 13;\n STRPAD H5T_STR_NULLTERM;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1260,7 +1260,7 @@ static int test_strings(void) goto out; } if(HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1270,13 +1270,13 @@ static int test_strings(void) str_len = str_len + 10; if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; - + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { HDfree(dt_str); goto out; } if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len-1)) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1292,10 +1292,10 @@ static int test_strings(void) goto out; } /* check the truncated string */ - if(strlen(dt_str) != str_len-1) goto out; - str_len = strlen(dt_str); + if(HDstrlen(dt_str) != str_len-1) goto out; + str_len = HDstrlen(dt_str); if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len)) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1352,7 +1352,7 @@ static int test_opaques(void) goto out; } if(HDstrcmp(dt_str, "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1428,7 +1428,7 @@ static int test_enums(void) } if(HDstrcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1469,16 +1469,16 @@ static int test_variables(void) if(H5Tis_variable_str(dtype)) goto out; - + if(H5Tclose(dtype)<0) goto out; - + if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_VLEN { H5T_STD_I32BE } }", H5LT_DDL))<0) goto out; - + if(H5Tis_variable_str(dtype)) goto out; - + if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) @@ -1488,15 +1488,15 @@ static int test_variables(void) goto out; } if(HDstrcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } HDfree(dt_str); - + if(H5Tclose(dtype)<0) goto out; - + PASSED(); return 0; @@ -1547,7 +1547,7 @@ static int test_arrays(void) goto out; } if(HDstrcmp(dt_str, "H5T_ARRAY {\n [5][7][13] H5T_ARRAY {\n [17][19] H5T_COMPOUND {\n H5T_STD_I8BE \"arr_compound_1\" : 0;\n H5T_STD_I32BE \"arr_compound_2\" : 1;\n }\n }\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1603,7 +1603,7 @@ static int test_compounds(void) goto out; } if(HDstrcmp(dt_str, "H5T_COMPOUND {\n H5T_STD_I16BE \"one_field\" : 2;\n H5T_STD_U8LE \"two_field\" : 6;\n }")) { - printf("dt=\n%s\n", dt_str); + HDprintf("dt=\n%s\n", dt_str); HDfree(dt_str); goto out; } @@ -1637,7 +1637,7 @@ out: } /*------------------------------------------------------------------------- -* subroutine for test_text_dtype(): test_compound_bug(). Test case for +* subroutine for test_text_dtype(): test_compound_bug(). Test case for * issue 7701. *------------------------------------------------------------------------- */ @@ -1770,7 +1770,7 @@ static int test_complicated_compound(void) /* Open input file */ fp = HDfopen(filename, "r"); if(fp == NULL) { - printf( "Could not find file %s. Try set $srcdir \n", filename); + HDprintf( "Could not find file %s. Try set $srcdir \n", filename); goto out; } @@ -1881,9 +1881,9 @@ static int test_valid_path(void) hid_t file_id, group; htri_t path_valid; const char *data_string_in = "test"; - + TESTING("H5LTpath_valid"); - + /* Create a new file using default properties. */ /************************************************************** @@ -1908,11 +1908,11 @@ static int test_valid_path(void) * | * | * | --- Gcyc (soft link to /G1) - * / \ - * / \ - * G5 \ + * / \ + * / \ + * G5 \ * (soft link G6 (external link /G1 in FILENAME4) - * to /G2) + * to /G2) * ****************************************************************/ @@ -1941,7 +1941,7 @@ static int test_valid_path(void) */ if(H5LTmake_dataset_string(group, "/G2/DS4", data_string_in)<0) goto out; - + /* * Create a soft link */ @@ -2023,9 +2023,9 @@ static int test_valid_path(void) * | * | * | - * G1 + * G1 * / \ - * / \ + * / \ * DS1 G2 * (dangled soft link to /G1/G20) * @@ -2056,13 +2056,13 @@ static int test_valid_path(void) goto out; H5Fclose(file_id); - + /* Open input file */ if((file_id = H5Fopen(FILE_NAME3,H5F_ACC_RDONLY, H5P_DEFAULT))<0) goto out; /************************************** - * CHECK ABSOLUTE PATHS + * CHECK ABSOLUTE PATHS **************************************/ if( (path_valid = H5LTpath_valid(file_id, "/", TRUE)) != TRUE) { @@ -2076,7 +2076,7 @@ static int test_valid_path(void) if( (path_valid = H5LTpath_valid(file_id, "/G1", TRUE)) != TRUE) { goto out; } - + if((path_valid = H5LTpath_valid(file_id, "/G1/DS1", TRUE)) != TRUE) goto out; @@ -2094,7 +2094,7 @@ static int test_valid_path(void) if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", TRUE)) != TRUE) goto out; - + if( (path_valid = H5LTpath_valid(file_id, "/G2", TRUE)) != TRUE) goto out; @@ -2114,14 +2114,14 @@ static int test_valid_path(void) /* check soft links */ if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G5/DS4", TRUE)) != TRUE) goto out; - + /************************************** - * CHECK RELATIVE PATHS + * CHECK RELATIVE PATHS ***************************************/ if( (group = H5Gopen2(file_id, "/", H5P_DEFAULT)) < 0) goto out; - + if( (path_valid = H5LTpath_valid(group, "/", TRUE)) != TRUE) { goto out; } @@ -2156,22 +2156,22 @@ static int test_valid_path(void) goto out; if( (path_valid = H5LTpath_valid(group, "G2/G5", TRUE)) != TRUE) - goto out; + goto out; /* Check the "./" case */ if( (path_valid = H5LTpath_valid(group, "./DS3", TRUE)) != TRUE) goto out; if( (path_valid = H5LTpath_valid(group, "./G2/G5", TRUE)) != TRUE) - goto out; + goto out; /* Should fail, does not exist */ if( (path_valid = H5LTpath_valid(group, "./G2/G20", FALSE)) == TRUE) - goto out; + goto out; /* Should fail, does not exist */ if( (path_valid = H5LTpath_valid(group, "./G2/G20", TRUE)) == TRUE) - goto out; + goto out; if(H5Gclose(group)<0) goto out; @@ -2220,7 +2220,7 @@ static int test_valid_path(void) PASSED(); return 0; - out: + out: H5_FAILED(); return -1; } |