diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
commit | b2d661b508a7fc7a2592c13bc6bdc175551f075d (patch) | |
tree | 13baeb0d83a7c2a4c6299993c182b1227c2f6114 /test/vol_plugin.c | |
parent | 29ab58b58dce556639ea3154e262895773a8a8df (diff) | |
download | hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2 |
Clang-format of source files
Diffstat (limited to 'test/vol_plugin.c')
-rw-r--r-- | test/vol_plugin.c | 167 |
1 files changed, 81 insertions, 86 deletions
diff --git a/test/vol_plugin.c b/test/vol_plugin.c index 565c847..15aec12 100644 --- a/test/vol_plugin.c +++ b/test/vol_plugin.c @@ -23,7 +23,6 @@ #include "null_vol_connector.h" - /*------------------------------------------------------------------------- * Function: test_registration_by_value() * @@ -37,49 +36,47 @@ static herr_t test_registration_by_value(void) { - htri_t is_registered = FAIL; - hid_t vol_id = H5I_INVALID_HID; + htri_t is_registered = FAIL; + hid_t vol_id = H5I_INVALID_HID; TESTING("VOL registration by value"); /* The null VOL connector should not be registered at the start of the test */ - if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) + if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) TEST_ERROR; - if(TRUE == is_registered) + if (TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); /* Register the connector by value */ - if((vol_id = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0) + if ((vol_id = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0) TEST_ERROR; /* The connector should be registered now */ - if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) + if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) TEST_ERROR; - if(FALSE == is_registered) + if (FALSE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector was not registered"); /* Unregister the connector */ - if(H5VLunregister_connector(vol_id) < 0) + if (H5VLunregister_connector(vol_id) < 0) TEST_ERROR; /* The connector should not be registered now */ - if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) + if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) TEST_ERROR; - if(TRUE == is_registered) + if (TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); PASSED(); return SUCCEED; error: - H5E_BEGIN_TRY { - H5VLunregister_connector(vol_id); - } H5E_END_TRY; + H5E_BEGIN_TRY { H5VLunregister_connector(vol_id); } + H5E_END_TRY; return FAIL; } /* end test_registration_by_value() */ - /*------------------------------------------------------------------------- * Function: test_registration_by_name() * @@ -93,49 +90,47 @@ error: static herr_t test_registration_by_name(void) { - htri_t is_registered = FAIL; - hid_t vol_id = H5I_INVALID_HID; + htri_t is_registered = FAIL; + hid_t vol_id = H5I_INVALID_HID; TESTING("VOL registration by name"); /* The null VOL connector should not be registered at the start of the test */ - if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) + if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; - if(TRUE == is_registered) + if (TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); /* Register the connector by name */ - if((vol_id = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0) + if ((vol_id = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* The connector should be registered now */ - if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) + if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; - if(FALSE == is_registered) + if (FALSE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector was not registered"); /* Unregister the connector */ - if(H5VLunregister_connector(vol_id) < 0) + if (H5VLunregister_connector(vol_id) < 0) TEST_ERROR; /* The connector should not be registered now */ - if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) + if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; - if(TRUE == is_registered) + if (TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); PASSED(); return SUCCEED; error: - H5E_BEGIN_TRY { - H5VLunregister_connector(vol_id); - } H5E_END_TRY; + H5E_BEGIN_TRY { H5VLunregister_connector(vol_id); } + H5E_END_TRY; return FAIL; } /* end test_registration_by_name() */ - /*------------------------------------------------------------------------- * Function: test_multiple_registration() * @@ -149,97 +144,98 @@ error: static herr_t test_multiple_registration(void) { - htri_t is_registered = FAIL; - hid_t vol_ids[N_REGISTRATIONS]; - int i; + htri_t is_registered = FAIL; + hid_t vol_ids[N_REGISTRATIONS]; + int i; TESTING("registering a VOL connector multiple times"); /* The null VOL connector should not be registered at the start of the test */ - if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) + if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; - if(TRUE == is_registered) + if (TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); /* Register the connector multiple times */ - for(i = 0; i < N_REGISTRATIONS; i++) { - if((vol_ids[i] = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0) + for (i = 0; i < N_REGISTRATIONS; i++) { + if ((vol_ids[i] = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; } /* The connector should be registered now */ - if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) + if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; - if(FALSE == is_registered) + if (FALSE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector was not registered"); /* Unregister the connector */ - for(i = 0; i < N_REGISTRATIONS; i++) { - if(H5VLunregister_connector(vol_ids[i]) < 0) + for (i = 0; i < N_REGISTRATIONS; i++) { + if (H5VLunregister_connector(vol_ids[i]) < 0) TEST_ERROR; /* Also test close on some of the IDs. This call currently works * identically to unregister. */ i++; - if(H5VLclose(vol_ids[i]) < 0) + if (H5VLclose(vol_ids[i]) < 0) TEST_ERROR; } /* The connector should not be registered now */ - if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) + if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; - if(TRUE == is_registered) + if (TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); /* Repeat testing with the _by_value routines */ - if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) + if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) TEST_ERROR; - if(TRUE == is_registered) + if (TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); /* Register the connector multiple times */ - for(i = 0; i < N_REGISTRATIONS; i++) { - if((vol_ids[i] = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0) + for (i = 0; i < N_REGISTRATIONS; i++) { + if ((vol_ids[i] = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0) TEST_ERROR; } /* The connector should be registered now */ - if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) + if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) TEST_ERROR; - if(FALSE == is_registered) + if (FALSE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector was not registered"); /* Unregister the connector */ - for(i = 0; i < N_REGISTRATIONS; i++) { - if(H5VLunregister_connector(vol_ids[i]) < 0) + for (i = 0; i < N_REGISTRATIONS; i++) { + if (H5VLunregister_connector(vol_ids[i]) < 0) TEST_ERROR; /* Also test close on some of the IDs. This call currently works * identically to unregister. */ i++; - if(H5VLclose(vol_ids[i]) < 0) + if (H5VLclose(vol_ids[i]) < 0) TEST_ERROR; } /* The connector should not be registered now */ - if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) + if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) TEST_ERROR; - if(TRUE == is_registered) + if (TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); PASSED(); return SUCCEED; error: - H5E_BEGIN_TRY { - for(i = 0; i < N_REGISTRATIONS; i++) + H5E_BEGIN_TRY + { + for (i = 0; i < N_REGISTRATIONS; i++) H5VLunregister_connector(vol_ids[i]); - } H5E_END_TRY; + } + H5E_END_TRY; return FAIL; } /* end test_multiple_registration() */ - /*------------------------------------------------------------------------- * Function: test_getters() * @@ -252,69 +248,70 @@ error: static herr_t test_getters(void) { - htri_t is_registered = FAIL; - hid_t vol_id = H5I_INVALID_HID; - hid_t vol_id_out = H5I_INVALID_HID; + htri_t is_registered = FAIL; + hid_t vol_id = H5I_INVALID_HID; + hid_t vol_id_out = H5I_INVALID_HID; TESTING("VOL getters"); /* The null VOL connector should not be registered at the start of the test */ - if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) + if ((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; - if(TRUE == is_registered) + if (TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); /* Register the connector by name */ - if((vol_id = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0) + if ((vol_id = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Get the connector's ID by name */ - if((vol_id_out = H5VLget_connector_id_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) + if ((vol_id_out = H5VLget_connector_id_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; - if(vol_id != vol_id_out) + if (vol_id != vol_id_out) FAIL_PUTS_ERROR("VOL connector IDs don't match"); - if(H5VLclose(vol_id_out) < 0) + if (H5VLclose(vol_id_out) < 0) TEST_ERROR; /* Unregister the connector */ - if(H5VLunregister_connector(vol_id) < 0) + if (H5VLunregister_connector(vol_id) < 0) TEST_ERROR; /* Repeat testing with the _by_value routines */ - if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) + if ((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) TEST_ERROR; - if(TRUE == is_registered) + if (TRUE == is_registered) FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered"); /* Register the connector by value */ - if((vol_id = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0) + if ((vol_id = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0) TEST_ERROR; /* Get the connector's ID by value */ - if((vol_id_out = H5VLget_connector_id_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) + if ((vol_id_out = H5VLget_connector_id_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0) TEST_ERROR; - if(vol_id != vol_id_out) + if (vol_id != vol_id_out) FAIL_PUTS_ERROR("VOL connector IDs don't match"); - if(H5VLclose(vol_id_out) < 0) + if (H5VLclose(vol_id_out) < 0) TEST_ERROR; /* Unregister the connector */ - if(H5VLunregister_connector(vol_id) < 0) + if (H5VLunregister_connector(vol_id) < 0) TEST_ERROR; PASSED(); return SUCCEED; error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5VLclose(vol_id_out); H5VLunregister_connector(vol_id); - } H5E_END_TRY; + } + H5E_END_TRY; return FAIL; } /* end test_getters() */ - /*------------------------------------------------------------------------- * Function: main * @@ -333,14 +330,13 @@ main(void) HDputs("Testing VOL connector plugin functionality."); - nerrors += test_registration_by_name() < 0 ? 1 : 0; - nerrors += test_registration_by_value() < 0 ? 1 : 0; - nerrors += test_multiple_registration() < 0 ? 1 : 0; - nerrors += test_getters() < 0 ? 1 : 0; + nerrors += test_registration_by_name() < 0 ? 1 : 0; + nerrors += test_registration_by_value() < 0 ? 1 : 0; + nerrors += test_multiple_registration() < 0 ? 1 : 0; + nerrors += test_getters() < 0 ? 1 : 0; - if(nerrors) { - HDprintf("***** %d VOL connector plugin TEST%s FAILED! *****\n", - nerrors, nerrors > 1 ? "S" : ""); + if (nerrors) { + HDprintf("***** %d VOL connector plugin TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); HDexit(EXIT_FAILURE); } @@ -349,4 +345,3 @@ main(void) HDexit(EXIT_SUCCESS); } /* end main() */ - |