diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 15:29:53 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-01 15:29:53 (GMT) |
commit | ec8ad09125032c9c232878d02e90aa86df162841 (patch) | |
tree | 5d63105d3a0db7d5bbee41c5b74b097649a2115e /test/version_bounds_1_10.c | |
parent | 453238e90e1574ef1c15e3c79f7fb3d77920e77c (diff) | |
download | hdf5-ec8ad09125032c9c232878d02e90aa86df162841.zip hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.gz hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.bz2 |
Source formatted
Diffstat (limited to 'test/version_bounds_1_10.c')
-rw-r--r-- | test/version_bounds_1_10.c | 220 |
1 files changed, 107 insertions, 113 deletions
diff --git a/test/version_bounds_1_10.c b/test/version_bounds_1_10.c index e07938c..f04a0fa 100644 --- a/test/version_bounds_1_10.c +++ b/test/version_bounds_1_10.c @@ -12,45 +12,44 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*********************************************************** -* -* Test program: version_bounds_1_10.c -* -* Test 1.10 compatibility with version bounds for files -* generated by gen_bounds.c in develop branch. -* -* -* The following tests are for testing datasets with references -* and selections respectively: -* --test_ref_bounds() -* --test_sel_bounds() -* -*************************************************************/ + * + * Test program: version_bounds_1_10.c + * + * Test 1.10 compatibility with version bounds for files + * generated by gen_bounds.c in develop branch. + * + * + * The following tests are for testing datasets with references + * and selections respectively: + * --test_ref_bounds() + * --test_sel_bounds() + * + *************************************************************/ #include "h5test.h" #include "H5srcdir.h" /* File names used in test_ref_bounds() */ -#define FILENAME_REF_E_L "bounds_ref_earliest_latest.h5" -#define FILENAME_REF_L_L "bounds_ref_latest_latest.h5" -#define FILENAME_REF_V112_V112 "bounds_ref_v112_v112.h5" -#define FILENAME_REF_V110_V110 "bounds_ref_v110_v110.h5" -#define FILENAME_REF_V18_V18 "bounds_ref_v18_v18.h5" +#define FILENAME_REF_E_L "bounds_ref_earliest_latest.h5" +#define FILENAME_REF_L_L "bounds_ref_latest_latest.h5" +#define FILENAME_REF_V112_V112 "bounds_ref_v112_v112.h5" +#define FILENAME_REF_V110_V110 "bounds_ref_v110_v110.h5" +#define FILENAME_REF_V18_V18 "bounds_ref_v18_v18.h5" /* Dataset names used in test_ref_bounds() */ -#define REVISED_REFS_DSET "Revised_refs_dset" -#define OLD_REF_OBJ_DSET "Old_ref_object_dset" -#define OLD_REF_REG_DSET "Old_ref_region_dset" +#define REVISED_REFS_DSET "Revised_refs_dset" +#define OLD_REF_OBJ_DSET "Old_ref_object_dset" +#define OLD_REF_REG_DSET "Old_ref_region_dset" /* File names used in test_sel_bounds() */ -#define FILENAME_SEL_E_L "bounds_sel_earliest_latest.h5" -#define FILENAME_SEL_L_L "bounds_sel_latest_latest.h5" -#define FILENAME_SEL_V112_V112 "bounds_sel_v112_v112.h5" -#define FILENAME_SEL_V110_V110 "bounds_sel_v110_v110.h5" +#define FILENAME_SEL_E_L "bounds_sel_earliest_latest.h5" +#define FILENAME_SEL_L_L "bounds_sel_latest_latest.h5" +#define FILENAME_SEL_V112_V112 "bounds_sel_v112_v112.h5" +#define FILENAME_SEL_V110_V110 "bounds_sel_v110_v110.h5" /* Dataset names used in test_sel_bounds() */ -#define SEL_EX_REG_DSET "Sel_ex32_reg_dset" -#define SEL_EX_IRR_DSET "Sel_ex32_irr_dset" -#define SEL_EX_PT_DSET "Sel_ex32_pt_dset" - +#define SEL_EX_REG_DSET "Sel_ex32_reg_dset" +#define SEL_EX_IRR_DSET "Sel_ex32_irr_dset" +#define SEL_EX_PT_DSET "Sel_ex32_pt_dset" /*********************************************************************** * @@ -62,61 +61,61 @@ static herr_t test_sel_check(hid_t fid, const char *dset_name, int should_open, int should_access) { - hid_t did = H5I_INVALID_HID; - hid_t sid = H5I_INVALID_HID; - hdset_reg_ref_t ref_rbuf[1]; /* The buffer for the reference */ + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hdset_reg_ref_t ref_rbuf[1]; /* The buffer for the reference */ /* Open and read the referenced dataset */ - H5E_BEGIN_TRY { - did = H5Dopen2(fid, dset_name, H5P_DEFAULT); - } H5E_END_TRY; - - if(should_open && (H5I_INVALID_HID == did)) + H5E_BEGIN_TRY { did = H5Dopen2(fid, dset_name, H5P_DEFAULT); } + H5E_END_TRY; + + if (should_open && (H5I_INVALID_HID == did)) FAIL_PUTS_ERROR("*** Should have been able to open the dataset ***"); - if(!should_open && (H5I_INVALID_HID != did)) + if (!should_open && (H5I_INVALID_HID != did)) FAIL_PUTS_ERROR("*** Should NOT have been able to open the dataset ***"); - if(did != H5I_INVALID_HID) { - if(H5Dread(did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_rbuf) < 0) + if (did != H5I_INVALID_HID) { + if (H5Dread(did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_rbuf) < 0) TEST_ERROR /* Open access to the region reference from the dataset's dataspace */ - H5E_BEGIN_TRY { - sid = H5Rget_region(did, H5R_DATASET_REGION, &ref_rbuf[0]); - } H5E_END_TRY; + H5E_BEGIN_TRY { sid = H5Rget_region(did, H5R_DATASET_REGION, &ref_rbuf[0]); } + H5E_END_TRY; - if(should_access && (H5I_INVALID_HID == sid)) + if (should_access && (H5I_INVALID_HID == sid)) FAIL_PUTS_ERROR("*** Should have been able to open the dataspace ***"); - if(!should_access && (H5I_INVALID_HID != sid)) + if (!should_access && (H5I_INVALID_HID != sid)) FAIL_PUTS_ERROR("*** Should NOT have been able to open the dataspace ***"); - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) TEST_ERROR - if(should_access && H5Sclose(sid) < 0) + if (should_access && H5Sclose(sid) < 0) TEST_ERROR } return SUCCEED; error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Dclose(did); H5Sclose(sid); - } H5E_END_TRY; + } + H5E_END_TRY; return FAIL; } /* test_sel_check() */ /*********************************************************************** - * test_sel_bounds(): + * test_sel_bounds(): * This routine will be used to read in the following test files * generated by gen_bounds.c in develop branch: * (1) FILENAME_SEL_E_L--"bounds_sel_earliest_latest.h5" * (2) FILENAME_SEL_L_L--"bounds_sel_latest_latest.h5" * (3) FILENAME_SEL_V110_V110--"bounds_sel_v110_v110.h5" * (4) FILENAME_SEL_V112_V112--"bounds_sel_v112_v112.h5" - * See detailed description of datasets created in those files in + * See detailed description of datasets created in those files in * gen_bounds.c in develop branch. * * @@ -134,78 +133,75 @@ error: * * Files #2, #4: * a) dataset SEL_EX_REG_DSET--"Sel_ex32_reg_dset" - * --if existed, succeed to open the datasets but fail to access + * --if existed, succeed to open the datasets but fail to access * the selection due to hyperslab selection version 3 * b) dataset SEL_EX_IRR_DSET--"Sel_ex32_irr_dset" - * --if existed, succeed to open the datasets but fail to access + * --if existed, succeed to open the datasets but fail to access * the selection due to hyperslab selection version 3 * c) dataset SEL_EX_PT_DSET--"Sel_ex32_pt_dset" - * --if existed, succeed to open the datasets but fail to access + * --if existed, succeed to open the datasets but fail to access * the selection due to point selection version 2 * ***********************************************************************/ static herr_t test_sel_bounds(const char *filename) { - hid_t fid = H5I_INVALID_HID; + hid_t fid = H5I_INVALID_HID; const char *path; - htri_t exists; + htri_t exists; HDprintf("Test file: %s\n", filename); TESTING("selection version bounds"); path = H5_get_srcdir_filename(filename); - if(H5I_INVALID_HID == (fid = H5Fopen(path, H5F_ACC_RDONLY, H5P_DEFAULT))) + if (H5I_INVALID_HID == (fid = H5Fopen(path, H5F_ACC_RDONLY, H5P_DEFAULT))) TEST_ERROR - if(!HDstrcmp(filename, FILENAME_SEL_E_L) || - !HDstrcmp(filename, FILENAME_SEL_V110_V110)) { + if (!HDstrcmp(filename, FILENAME_SEL_E_L) || !HDstrcmp(filename, FILENAME_SEL_V110_V110)) { - if((exists = H5Lexists(fid, SEL_EX_REG_DSET, H5P_DEFAULT)) < 0) + if ((exists = H5Lexists(fid, SEL_EX_REG_DSET, H5P_DEFAULT)) < 0) TEST_ERROR - if(exists && test_sel_check(fid, SEL_EX_REG_DSET, TRUE, TRUE) < 0) + if (exists && test_sel_check(fid, SEL_EX_REG_DSET, TRUE, TRUE) < 0) goto error; - if((exists = H5Lexists(fid, SEL_EX_IRR_DSET, H5P_DEFAULT)) < 0) + if ((exists = H5Lexists(fid, SEL_EX_IRR_DSET, H5P_DEFAULT)) < 0) TEST_ERROR - if(exists && test_sel_check(fid, SEL_EX_IRR_DSET, TRUE, FALSE) < 0) + if (exists && test_sel_check(fid, SEL_EX_IRR_DSET, TRUE, FALSE) < 0) goto error; - if((exists = H5Lexists(fid, SEL_EX_PT_DSET, H5P_DEFAULT)) < 0) + if ((exists = H5Lexists(fid, SEL_EX_PT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR - if(exists && test_sel_check(fid, SEL_EX_PT_DSET, TRUE, FALSE) < 0) + if (exists && test_sel_check(fid, SEL_EX_PT_DSET, TRUE, FALSE) < 0) goto error; - } else { - - if((exists = H5Lexists(fid, SEL_EX_REG_DSET, H5P_DEFAULT)) < 0) + + if ((exists = H5Lexists(fid, SEL_EX_REG_DSET, H5P_DEFAULT)) < 0) TEST_ERROR - if(exists && test_sel_check(fid, SEL_EX_REG_DSET, TRUE, FALSE) < 0) + if (exists && test_sel_check(fid, SEL_EX_REG_DSET, TRUE, FALSE) < 0) goto error; - if((exists = H5Lexists(fid, SEL_EX_IRR_DSET, H5P_DEFAULT)) < 0) + if ((exists = H5Lexists(fid, SEL_EX_IRR_DSET, H5P_DEFAULT)) < 0) TEST_ERROR - if(exists && test_sel_check(fid, SEL_EX_IRR_DSET, TRUE, FALSE) < 0) + if (exists && test_sel_check(fid, SEL_EX_IRR_DSET, TRUE, FALSE) < 0) goto error; - if((exists = H5Lexists(fid, SEL_EX_PT_DSET, H5P_DEFAULT)) < 0) + if ((exists = H5Lexists(fid, SEL_EX_PT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR - if(test_sel_check(fid, SEL_EX_PT_DSET, TRUE, FALSE) < 0) + if (test_sel_check(fid, SEL_EX_PT_DSET, TRUE, FALSE) < 0) goto error; } - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) TEST_ERROR PASSED(); return SUCCEED; error: - H5E_BEGIN_TRY { - H5Fclose(fid); - } H5E_END_TRY; + H5E_BEGIN_TRY { H5Fclose(fid); } + H5E_END_TRY; return FAIL; } /* test_sel_bounds() */ @@ -219,18 +215,17 @@ error: static herr_t test_ref_check(hid_t fid, const char *dset_name, hbool_t should_open) { - hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ - H5E_BEGIN_TRY { - did = H5Dopen2(fid, dset_name, H5P_DEFAULT); - } H5E_END_TRY; + H5E_BEGIN_TRY { did = H5Dopen2(fid, dset_name, H5P_DEFAULT); } + H5E_END_TRY; - if(should_open && (H5I_INVALID_HID == did)) + if (should_open && (H5I_INVALID_HID == did)) FAIL_PUTS_ERROR("*** Should have been able to open the dataset ***"); - if(!should_open && (H5I_INVALID_HID != did)) + if (!should_open && (H5I_INVALID_HID != did)) FAIL_PUTS_ERROR("*** Should NOT have been able to open the dataset ***"); - if(should_open && H5Dclose(did) < 0) + if (should_open && H5Dclose(did) < 0) TEST_ERROR return SUCCEED; @@ -240,7 +235,7 @@ error: } /* test_ref_check() */ /*********************************************************************** - * test_ref_bounds(): + * test_ref_bounds(): * This routine will be used to read in the following test files * generated by gen_bounds.c in develop branch: * (1) FILENAME_REF_E_L--"bounds_ref_earliest_latest.h5" @@ -248,7 +243,7 @@ error: * (3) FILENAME_REF_V112_V112--"bounds_ref_v112_v112.h5" * (4) FILENAME_REF_V110_V110--"bounds_ref_v110_v110.h5" * (5) FILENAME_REF_V18_V18--"bounds_ref_v18_v18.h5" - * See detailed description of datasets created in those files in + * See detailed description of datasets created in those files in * gen_bounds.c in develop branch. * * @@ -256,7 +251,7 @@ error: * Files #1 to #5: * a) dataset REVISED_REFS_DSET--"Revised_refs_dset" * --if existed, fail to open this dataset due to datatype message version 4 - * b) dataset OLD_REF_OBJ_DSET--"Old_ref_object_dset" + * b) dataset OLD_REF_OBJ_DSET--"Old_ref_object_dset" * --if existed, succeed to open the dataset * c) dataset OLD_REF_REG_DSET--"Old_ref_region_dset" * --if existed, succeed to open the dataset @@ -266,42 +261,41 @@ static herr_t test_ref_bounds(const char *filename) { const char *path; - hid_t fid = H5I_INVALID_HID; - htri_t exists; + hid_t fid = H5I_INVALID_HID; + htri_t exists; HDprintf("Test file: %s\n", filename); TESTING("reference version bounds"); path = H5_get_srcdir_filename(filename); - if(H5I_INVALID_HID == (fid = H5Fopen(path, H5F_ACC_RDONLY, H5P_DEFAULT))) + if (H5I_INVALID_HID == (fid = H5Fopen(path, H5F_ACC_RDONLY, H5P_DEFAULT))) TEST_ERROR - if((exists = H5Lexists(fid, REVISED_REFS_DSET, H5P_DEFAULT)) < 0) + if ((exists = H5Lexists(fid, REVISED_REFS_DSET, H5P_DEFAULT)) < 0) TEST_ERROR - if(exists && test_ref_check(fid, REVISED_REFS_DSET, FALSE) < 0) + if (exists && test_ref_check(fid, REVISED_REFS_DSET, FALSE) < 0) goto error; - if((exists = H5Lexists(fid, OLD_REF_OBJ_DSET, H5P_DEFAULT)) < 0) + if ((exists = H5Lexists(fid, OLD_REF_OBJ_DSET, H5P_DEFAULT)) < 0) TEST_ERROR - if(exists && test_ref_check(fid, OLD_REF_OBJ_DSET, TRUE) < 0) + if (exists && test_ref_check(fid, OLD_REF_OBJ_DSET, TRUE) < 0) goto error; - if((exists = H5Lexists(fid, OLD_REF_REG_DSET, H5P_DEFAULT)) < 0) + if ((exists = H5Lexists(fid, OLD_REF_REG_DSET, H5P_DEFAULT)) < 0) TEST_ERROR - if(exists && test_ref_check(fid, OLD_REF_REG_DSET, TRUE) < 0) + if (exists && test_ref_check(fid, OLD_REF_REG_DSET, TRUE) < 0) goto error; - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) TEST_ERROR PASSED(); return SUCCEED; error: - H5E_BEGIN_TRY { - H5Fclose(fid); - } H5E_END_TRY; + H5E_BEGIN_TRY { H5Fclose(fid); } + H5E_END_TRY; return FAIL; } /* test_ref_bounds() */ @@ -321,21 +315,21 @@ main(void) HDprintf("Testing reference and selection version bounds.\n"); /* Verify the reference datasets in the test files */ - nerrors += test_ref_bounds(FILENAME_REF_E_L) < 0 ? 1 : 0; - nerrors += test_ref_bounds(FILENAME_REF_L_L) < 0 ? 1 : 0; - nerrors += test_ref_bounds(FILENAME_REF_V112_V112) < 0 ? 1 : 0; - nerrors += test_ref_bounds(FILENAME_REF_V110_V110) < 0 ? 1 : 0; - nerrors += test_ref_bounds(FILENAME_REF_V18_V18) < 0 ? 1 : 0; + nerrors += test_ref_bounds(FILENAME_REF_E_L) < 0 ? 1 : 0; + nerrors += test_ref_bounds(FILENAME_REF_L_L) < 0 ? 1 : 0; + nerrors += test_ref_bounds(FILENAME_REF_V112_V112) < 0 ? 1 : 0; + nerrors += test_ref_bounds(FILENAME_REF_V110_V110) < 0 ? 1 : 0; + nerrors += test_ref_bounds(FILENAME_REF_V18_V18) < 0 ? 1 : 0; /* Verify the selections of reference datasets in the test files */ - nerrors += test_sel_bounds(FILENAME_SEL_E_L) < 0 ? 1 : 0; - nerrors += test_sel_bounds(FILENAME_SEL_L_L) < 0 ? 1 : 0; - nerrors += test_sel_bounds(FILENAME_SEL_V112_V112) < 0 ? 1 : 0; - nerrors += test_sel_bounds(FILENAME_SEL_V110_V110) < 0 ? 1 : 0; - - if(nerrors) { - HDprintf("***** %d Reference and selection version bounds TEST%s FAILED! *****\n", - nerrors, nerrors > 1 ? "S" : ""); + nerrors += test_sel_bounds(FILENAME_SEL_E_L) < 0 ? 1 : 0; + nerrors += test_sel_bounds(FILENAME_SEL_L_L) < 0 ? 1 : 0; + nerrors += test_sel_bounds(FILENAME_SEL_V112_V112) < 0 ? 1 : 0; + nerrors += test_sel_bounds(FILENAME_SEL_V110_V110) < 0 ? 1 : 0; + + if (nerrors) { + HDprintf("***** %d Reference and selection version bounds TEST%s FAILED! *****\n", nerrors, + nerrors > 1 ? "S" : ""); return EXIT_FAILURE; } |