diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-09-05 20:11:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-05 20:11:52 (GMT) |
commit | 920869796031ed4ee9c1fbea8aaccda3592a88b3 (patch) | |
tree | 30f007ff79b87a79c882d9149cdbfcb797be92e1 /test/tmisc.c | |
parent | ae1379094b71c51342772397af5caca088862a61 (diff) | |
download | hdf5-920869796031ed4ee9c1fbea8aaccda3592a88b3.zip hdf5-920869796031ed4ee9c1fbea8aaccda3592a88b3.tar.gz hdf5-920869796031ed4ee9c1fbea8aaccda3592a88b3.tar.bz2 |
Convert hbool_t --> bool in test (#3494)
Diffstat (limited to 'test/tmisc.c')
-rw-r--r-- | test/tmisc.c | 117 |
1 files changed, 58 insertions, 59 deletions
diff --git a/test/tmisc.c b/test/tmisc.c index b66a80e..71791b2 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -1800,7 +1800,7 @@ test_misc10(void) hid_t dcpl; /* Dataset creation property list */ hid_t space, type; /* Old dataset's dataspace & datatype */ const char *testfile = H5_get_srcdir_filename(MISC10_FILE_OLD); /* Corrected test file name */ - hbool_t driver_is_default_compatible; + bool driver_is_default_compatible; herr_t ret; /* Output message about test being performed */ @@ -1883,7 +1883,7 @@ test_misc11(void) H5F_info2_t finfo; /* global information about file */ H5F_fspace_strategy_t strategy; /* File space strategy */ hsize_t threshold; /* Free-space section threshold */ - hbool_t persist; /* To persist free-space or not */ + bool persist; /* To persist free-space or not */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1944,7 +1944,7 @@ test_misc11(void) ret = H5Pset_shared_mesg_nindexes(fcpl, MISC11_NINDEXES); CHECK(ret, FAIL, "H5Pset_shared_mesg"); - ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1); + ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, false, (hsize_t)1); CHECK(ret, FAIL, "H5Pset_file_space"); /* Creating a file with the non-default file creation property list should @@ -2011,7 +2011,7 @@ test_misc11(void) ret = H5Pget_file_space_strategy(fcpl, &strategy, &persist, &threshold); CHECK(ret, FAIL, "H5Pget_file_space_strategy"); VERIFY(strategy, 3, "H5Pget_file_space_strategy"); - VERIFY(persist, FALSE, "H5Pget_file_space_strategy"); + VERIFY(persist, false, "H5Pget_file_space_strategy"); VERIFY(threshold, 1, "H5Pget_file_space_strategy"); /* Close file */ @@ -2157,16 +2157,16 @@ misc13_init_data(unsigned *original_data) original_data[u] = u; } -static hbool_t +static bool misc13_verify_data_match(const unsigned *original_data, const unsigned *read_data) { unsigned u; for (u = 0; u < MISC13_DIM1; u++) if (original_data[u] != read_data[u]) - return FALSE; + return false; - return TRUE; + return true; } static void @@ -2380,8 +2380,7 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char } /* end misc13_insert_user_block() */ static void -misc13_verify_file(const char *name, const unsigned *data, hsize_t userblock_size, - hbool_t check_for_new_dataset) +misc13_verify_file(const char *name, const unsigned *data, hsize_t userblock_size, bool check_for_new_dataset) { hid_t fid = -1; /* File ID */ hid_t gid1 = -1; /* Group IDs */ @@ -2425,7 +2424,7 @@ misc13_verify_file(const char *name, const unsigned *data, hsize_t userblock_siz CHECK(tid, FAIL, "H5Topen2"); /* Verify the type is correct */ - VERIFY(H5Tequal(tid, H5T_NATIVE_INT), TRUE, "H5Tequal"); + VERIFY(H5Tequal(tid, H5T_NATIVE_INT), true, "H5Tequal"); /* Close named datatype */ ret = H5Tclose(tid); @@ -2446,7 +2445,7 @@ misc13_verify_file(const char *name, const unsigned *data, hsize_t userblock_siz CHECK(tid, FAIL, "H5Topen2"); /* Verify the type is correct */ - VERIFY(H5Tequal(tid, H5T_NATIVE_INT), TRUE, "H5Tequal"); + VERIFY(H5Tequal(tid, H5T_NATIVE_INT), true, "H5Tequal"); /* Close named datatype */ ret = H5Tclose(tid); @@ -2500,7 +2499,7 @@ test_misc13(void) { unsigned *data = NULL; /* Data to write to dataset */ hsize_t userblock_size; /* Correct size of userblock */ - hbool_t check_for_new_dataset; /* Whether to check for the post-userblock-creation dataset */ + bool check_for_new_dataset; /* Whether to check for the post-userblock-creation dataset */ /* Create a data buffer for the datasets */ data = (unsigned *)calloc(MISC13_DIM1, sizeof(unsigned)); @@ -2514,7 +2513,7 @@ test_misc13(void) /* Verify file contents are correct */ userblock_size = 0; - check_for_new_dataset = FALSE; + check_for_new_dataset = false; misc13_verify_file(MISC13_FILE_1, data, userblock_size, check_for_new_dataset); /* Create a new file by inserting a user block in front of the first file */ @@ -2522,7 +2521,7 @@ test_misc13(void) /* Verify file contents are still correct */ userblock_size = MISC13_USERBLOCK_SIZE; - check_for_new_dataset = FALSE; + check_for_new_dataset = false; misc13_verify_file(MISC13_FILE_2, data, userblock_size, check_for_new_dataset); /* Make certain we can modify the new file */ @@ -2530,7 +2529,7 @@ test_misc13(void) /* Verify file contents are still correct */ userblock_size = MISC13_USERBLOCK_SIZE; - check_for_new_dataset = TRUE; + check_for_new_dataset = true; misc13_verify_file(MISC13_FILE_2, data, userblock_size, check_for_new_dataset); /* Free the dataset buffer */ @@ -3703,7 +3702,7 @@ test_misc20(void) unsigned version; /* Version of storage layout info */ hsize_t contig_size; /* Size of contiguous storage size from layout into */ const char *testfile = H5_get_srcdir_filename(MISC20_FILE_OLD); /* Corrected test file name */ - hbool_t driver_is_default_compatible; + bool driver_is_default_compatible; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -4180,7 +4179,7 @@ test_misc23(void) CHECK(create_id, FAIL, "H5Pcreate"); /* Set flag for intermediate group creation */ - status = H5Pset_create_intermediate_group(create_id, TRUE); + status = H5Pset_create_intermediate_group(create_id, true); CHECK(status, FAIL, "H5Pset_create_intermediate_group"); tmp_id = H5Gcreate2(file_id, "/A/B01/grp", create_id, H5P_DEFAULT, access_id); @@ -4241,7 +4240,7 @@ test_misc23(void) CHECK(create_id, FAIL, "H5Pcreate"); /* Set flag for intermediate group creation */ - status = H5Pset_create_intermediate_group(create_id, TRUE); + status = H5Pset_create_intermediate_group(create_id, true); CHECK(status, FAIL, "H5Pset_create_intermediate_group"); tmp_id = H5Dcreate2(file_id, "/A/B06/dset", type_id, space_id, create_id, H5P_DEFAULT, H5P_DEFAULT); @@ -4292,7 +4291,7 @@ test_misc23(void) CHECK(create_id, FAIL, "H5Pcreate"); /* Set flag for intermediate group creation */ - status = H5Pset_create_intermediate_group(create_id, TRUE); + status = H5Pset_create_intermediate_group(create_id, true); CHECK(status, FAIL, "H5Pset_create_intermediate_group"); tmp_id = H5Tcopy(H5T_NATIVE_INT16); @@ -4352,17 +4351,17 @@ test_misc23(void) CHECK(create_id, FAIL, "H5Pcreate"); /* Set flag for intermediate group creation */ - status = H5Pset_create_intermediate_group(create_id, TRUE); + status = H5Pset_create_intermediate_group(create_id, true); CHECK(status, FAIL, "H5Pset_create_intermediate_group"); status = H5Lcopy(file_id, "/A/B01/grp", file_id, "/A/B16/grp", create_id, access_id); CHECK(status, FAIL, "H5Lcopy"); tri_status = H5Lexists(file_id, "/A/B16/grp", access_id); - VERIFY(tri_status, TRUE, "H5Lexists"); + VERIFY(tri_status, true, "H5Lexists"); tri_status = H5Lexists(file_id, "/A/B01/grp", access_id); - VERIFY(tri_status, TRUE, "H5Lexists"); + VERIFY(tri_status, true, "H5Lexists"); /********************************************************************** * test H5Lmove() @@ -4372,10 +4371,10 @@ test_misc23(void) CHECK(status, FAIL, "H5Lmove"); tri_status = H5Lexists(file_id, "/A/B17/grp", access_id); - VERIFY(tri_status, TRUE, "H5Lexists"); + VERIFY(tri_status, true, "H5Lexists"); tri_status = H5Lexists(file_id, "/A/B16/grp", access_id); - VERIFY(tri_status, FALSE, "H5Lexists"); + VERIFY(tri_status, false, "H5Lexists"); /********************************************************************** * test H5Lcreate_hard() @@ -4385,7 +4384,7 @@ test_misc23(void) CHECK(status, FAIL, "H5Lcreate_hard"); tri_status = H5Lexists(file_id, "/A/B18/grp", access_id); - VERIFY(tri_status, TRUE, "H5Lexists"); + VERIFY(tri_status, true, "H5Lexists"); /********************************************************************** * test H5Lcreate_soft() @@ -4395,7 +4394,7 @@ test_misc23(void) CHECK(status, FAIL, "H5Lcreate_soft"); tri_status = H5Lexists(file_id, "/A/B19/grp", access_id); - VERIFY(tri_status, TRUE, "H5Lexists"); + VERIFY(tri_status, true, "H5Lexists"); /********************************************************************** * test H5Lcreate_external() @@ -4405,7 +4404,7 @@ test_misc23(void) CHECK(status, FAIL, "H5Lcreate_external"); tri_status = H5Lexists(file_id, "/A/B20/grp", access_id); - VERIFY(tri_status, TRUE, "H5Lexists"); + VERIFY(tri_status, true, "H5Lexists"); /********************************************************************** * test H5Lcreate_ud() @@ -4416,7 +4415,7 @@ test_misc23(void) CHECK(status, FAIL, "H5Lcreate_ud"); tri_status = H5Lexists(file_id, "/A/B21/grp", access_id); - VERIFY(tri_status, TRUE, "H5Lexists"); + VERIFY(tri_status, true, "H5Lexists"); /********************************************************************** * close @@ -4999,7 +4998,7 @@ test_misc25b(void) hid_t fid; /* File ID */ hid_t gid; /* Group ID */ const char *testfile = H5_get_srcdir_filename(MISC25B_FILE); /* Corrected test file name */ - hbool_t driver_is_default_compatible; + bool driver_is_default_compatible; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -5260,7 +5259,7 @@ test_misc27(void) hid_t fid; /* File ID */ hid_t gid; /* Group ID */ const char *testfile = H5_get_srcdir_filename(MISC27_FILE); /* Corrected test file name */ - hbool_t driver_is_default_compatible; + bool driver_is_default_compatible; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -5483,9 +5482,9 @@ test_misc28(void) static void test_misc29(void) { - hbool_t driver_is_default_compatible; - hid_t fid; /* File ID */ - herr_t ret; /* Generic return value */ + bool driver_is_default_compatible; + hid_t fid; /* File ID */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Speculative metadata reads\n")); @@ -5546,7 +5545,7 @@ test_misc30(void) /* Output message about test being performed */ MESSAGE(5, ("Local heap dropping free block info\n")); - for (get_info = FALSE; get_info <= TRUE; get_info++) { + for (get_info = false; get_info <= true; get_info++) { hid_t fid; /* File ID */ hid_t gid; /* Group ID */ int i; /* Local index counter */ @@ -5726,15 +5725,15 @@ test_misc32(void) /* Size zero returns NULL. * Also checks that a size of zero and setting the buffer clear flag - * to TRUE can be used together. + * to true can be used together. * * Note that we have asserts in the code, so only check when NDEBUG * is defined. */ #ifdef NDEBUG - buffer = H5allocate_memory(0, FALSE); + buffer = H5allocate_memory(0, false); CHECK_PTR_NULL(buffer, "H5allocate_memory"); /*BAD*/ - buffer = H5allocate_memory(0, TRUE); + buffer = H5allocate_memory(0, true); CHECK_PTR_NULL(buffer, "H5allocate_memory"); /*BAD*/ #endif /* NDEBUG */ @@ -5742,7 +5741,7 @@ test_misc32(void) /* Size zero returns NULL. Valgrind will confirm buffer is freed. */ size = 1024; - buffer = H5allocate_memory(size, TRUE); + buffer = H5allocate_memory(size, true); resized = H5resize_memory(buffer, 0); CHECK_PTR_NULL(resized, "H5resize_memory"); @@ -5775,7 +5774,7 @@ test_misc33(void) hid_t fid = -1; /* File ID */ const char *testfile = H5_get_srcdir_filename(MISC33_FILE); /* Corrected test file name */ H5O_info2_t oinfo; /* Structure for object metadata information */ - hbool_t driver_is_default_compatible; + bool driver_is_default_compatible; herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -5955,15 +5954,15 @@ static int test_misc36_context; static void test_misc36_cb1(void *_ctx) { - int *ctx = (int *)_ctx; /* Set up context pointer */ - hbool_t is_terminating; /* Flag indicating the library is terminating */ - herr_t ret; /* Return value */ + int *ctx = (int *)_ctx; /* Set up context pointer */ + bool is_terminating; /* Flag indicating the library is terminating */ + herr_t ret; /* Return value */ /* Check whether the library thinks it's terminating */ - is_terminating = FALSE; + is_terminating = false; ret = H5is_library_terminating(&is_terminating); CHECK(ret, FAIL, "H5is_library_terminating"); - VERIFY(is_terminating, TRUE, "H5is_library_terminating"); + VERIFY(is_terminating, true, "H5is_library_terminating"); /* Verify correct ordering for 'atclose' callbacks */ if (0 != *ctx) @@ -5976,15 +5975,15 @@ test_misc36_cb1(void *_ctx) static void test_misc36_cb2(void *_ctx) { - int *ctx = (int *)_ctx; /* Set up context pointer */ - hbool_t is_terminating; /* Flag indicating the library is terminating */ - herr_t ret; /* Return value */ + int *ctx = (int *)_ctx; /* Set up context pointer */ + bool is_terminating; /* Flag indicating the library is terminating */ + herr_t ret; /* Return value */ /* Check whether the library thinks it's terminating */ - is_terminating = FALSE; + is_terminating = false; ret = H5is_library_terminating(&is_terminating); CHECK(ret, FAIL, "H5is_library_terminating"); - VERIFY(is_terminating, TRUE, "H5is_library_terminating"); + VERIFY(is_terminating, true, "H5is_library_terminating"); /* Verify correct ordering for 'atclose' callbacks */ if (1 != *ctx) @@ -6002,27 +6001,27 @@ test_misc36_cb2(void *_ctx) static void test_misc36(void) { - hbool_t is_terminating; /* Flag indicating the library is terminating */ - herr_t ret; /* Return value */ + bool is_terminating; /* Flag indicating the library is terminating */ + herr_t ret; /* Return value */ /* Output message about test being performed */ MESSAGE(5, ("H5atclose and H5is_library_terminating API calls")); /* Check whether the library thinks it's terminating */ - is_terminating = TRUE; + is_terminating = true; ret = H5is_library_terminating(&is_terminating); CHECK(ret, FAIL, "H5is_library_terminating"); - VERIFY(is_terminating, FALSE, "H5is_library_terminating"); + VERIFY(is_terminating, false, "H5is_library_terminating"); /* Shut the library down */ test_misc36_context = 0; H5close(); /* Check whether the library thinks it's terminating */ - is_terminating = TRUE; + is_terminating = true; ret = H5is_library_terminating(&is_terminating); CHECK(ret, FAIL, "H5is_library_terminating"); - VERIFY(is_terminating, FALSE, "H5is_library_terminating"); + VERIFY(is_terminating, false, "H5is_library_terminating"); /* Check the close context was not changed */ VERIFY(test_misc36_context, 0, "H5atclose"); @@ -6031,10 +6030,10 @@ test_misc36(void) H5open(); /* Check whether the library thinks it's terminating */ - is_terminating = TRUE; + is_terminating = true; ret = H5is_library_terminating(&is_terminating); CHECK(ret, FAIL, "H5is_library_terminating"); - VERIFY(is_terminating, FALSE, "H5is_library_terminating"); + VERIFY(is_terminating, false, "H5is_library_terminating"); /* Register the 'atclose' callbacks */ /* (Note that these will be called in reverse order, which is checked) */ @@ -6073,7 +6072,7 @@ static void test_misc37(void) { const char *testfile = H5_get_srcdir_filename(CVE_2020_10812_FILENAME); - hbool_t driver_is_default_compatible; + bool driver_is_default_compatible; hid_t fid; herr_t ret; @@ -6110,7 +6109,7 @@ test_misc37(void) void test_misc(void) { - hbool_t default_driver = h5_using_default_driver(NULL); + bool default_driver = h5_using_default_driver(NULL); /* Output message about test being performed */ MESSAGE(5, ("Testing Miscellaneous Routines\n")); |