mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-13 16:47:58 +08:00
Fix mistake with H5E_BEGIN_TRY {...} H5E_END_TRY block containing ERROR-raising macros.
Formatting tweaks.
This commit is contained in:
parent
38de07aea3
commit
210ab50725
47
test/dsets.c
47
test/dsets.c
@ -13063,6 +13063,7 @@ test_object_header_minimization_dcpl(void)
|
||||
hid_t file_id = -1;
|
||||
char filename[FILENAME_BUF_SIZE] = "";
|
||||
hbool_t minimize = FALSE;
|
||||
herr_t ret;
|
||||
|
||||
TESTING("dcpl flags to minimize dataset object header");
|
||||
|
||||
@ -13087,25 +13088,25 @@ test_object_header_minimization_dcpl(void)
|
||||
|
||||
/* default value (not set explicitly)
|
||||
*/
|
||||
if (FAIL == H5Pget_dset_no_attrs_hint(dcpl_id, &minimize))
|
||||
if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL)
|
||||
FAIL_PUTS_ERROR("unable to get minimize value\n");
|
||||
if (FALSE != minimize)
|
||||
FAIL_PUTS_ERROR("Expected FALSE default but was not!\n");
|
||||
|
||||
/* FALSE-set value
|
||||
*/
|
||||
if (FAIL == H5Pset_dset_no_attrs_hint(dcpl_id, FALSE))
|
||||
if (H5Pset_dset_no_attrs_hint(dcpl_id, FALSE) == FAIL)
|
||||
FAIL_PUTS_ERROR("unable to set minimize value to FALSE\n");
|
||||
if (FAIL == H5Pget_dset_no_attrs_hint(dcpl_id, &minimize))
|
||||
if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL)
|
||||
FAIL_PUTS_ERROR("unable to get minimize value\n");
|
||||
if (FALSE != minimize)
|
||||
FAIL_PUTS_ERROR("Expected FALSE default but was not!\n");
|
||||
|
||||
/* TRUE-set value
|
||||
*/
|
||||
if (FAIL == H5Pset_dset_no_attrs_hint(dcpl_id, TRUE))
|
||||
if (H5Pset_dset_no_attrs_hint(dcpl_id, TRUE) == FAIL)
|
||||
FAIL_PUTS_ERROR("unable to set minimize value to TRUE\n");
|
||||
if (FAIL == H5Pget_dset_no_attrs_hint(dcpl_id, &minimize))
|
||||
if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL)
|
||||
FAIL_PUTS_ERROR("unable to get minimize value\n");
|
||||
if (TRUE != minimize)
|
||||
FAIL_PUTS_ERROR("Expected TRUE default but was not!\n");
|
||||
@ -13113,27 +13114,37 @@ test_object_header_minimization_dcpl(void)
|
||||
/* error cases
|
||||
*/
|
||||
H5E_BEGIN_TRY {
|
||||
if (SUCCEED == H5Pget_dset_no_attrs_hint(-1, &minimize))
|
||||
FAIL_PUTS_ERROR("Invalid DCPL ID should fail\n");
|
||||
|
||||
if (SUCCEED == H5Pset_dset_no_attrs_hint(-1, FALSE))
|
||||
FAIL_PUTS_ERROR("Invalid DCPL ID should fail\n");
|
||||
|
||||
if (SUCCEED == H5Pset_dset_no_attrs_hint(-1, TRUE))
|
||||
FAIL_PUTS_ERROR("Invalid DCPL ID should fail\n");
|
||||
|
||||
if (SUCCEED == H5Pget_dset_no_attrs_hint(dcpl_id, NULL))
|
||||
FAIL_PUTS_ERROR("NULL out pointer should fail\n");
|
||||
ret = H5Pget_dset_no_attrs_hint(-1, &minimize);
|
||||
} H5E_END_TRY;
|
||||
if (ret == SUCCEED)
|
||||
FAIL_PUTS_ERROR("Invalid DCPL ID should fail\n");
|
||||
|
||||
H5E_BEGIN_TRY {
|
||||
ret = H5Pset_dset_no_attrs_hint(-1, FALSE);
|
||||
} H5E_END_TRY;
|
||||
if (ret == SUCCEED)
|
||||
FAIL_PUTS_ERROR("Invalid DCPL ID should fail\n");
|
||||
|
||||
H5E_BEGIN_TRY {
|
||||
ret = H5Pset_dset_no_attrs_hint(-1, TRUE);
|
||||
} H5E_END_TRY;
|
||||
if (ret == SUCCEED)
|
||||
FAIL_PUTS_ERROR("Invalid DCPL ID should fail\n");
|
||||
|
||||
H5E_BEGIN_TRY {
|
||||
ret = H5Pget_dset_no_attrs_hint(dcpl_id, NULL);
|
||||
} H5E_END_TRY;
|
||||
if (ret == SUCCEED)
|
||||
FAIL_PUTS_ERROR("NULL out pointer should fail\n");
|
||||
|
||||
/************/
|
||||
/* TEARDOWN */
|
||||
/************/
|
||||
|
||||
if (FAIL == H5Fclose(file_id))
|
||||
if (H5Fclose(file_id) == FAIL)
|
||||
FAIL_PUTS_ERROR("can't close FILE");
|
||||
|
||||
if (FAIL == H5Pclose(dcpl_id))
|
||||
if (H5Pclose(dcpl_id) == FAIL)
|
||||
FAIL_PUTS_ERROR("unable to close DCPL\n");
|
||||
|
||||
PASSED();
|
||||
|
@ -15086,7 +15086,7 @@ main(void)
|
||||
nerrors += group_info_old(fapl) < 0 ? 1 : 0;
|
||||
|
||||
if (minimize_dset_oh) {
|
||||
if (0 > H5Pclose(dcpl_g))
|
||||
if (H5Pclose(dcpl_g) < 0)
|
||||
TEST_ERROR;
|
||||
dcpl_g = -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user