summaryrefslogtreecommitdiffstats
path: root/test/file_image.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-05-04 15:49:01 (GMT)
committerGitHub <noreply@github.com>2022-05-04 15:49:01 (GMT)
commit838d050a63d310a38f92a510dc94c0656a84bb51 (patch)
tree55fe7b05c0408ebf4b28c3bfb5cd9a1d04fb2502 /test/file_image.c
parent19a59c29b93c04ae069881da2354d3d7048619b9 (diff)
downloadhdf5-838d050a63d310a38f92a510dc94c0656a84bb51.zip
hdf5-838d050a63d310a38f92a510dc94c0656a84bb51.tar.gz
hdf5-838d050a63d310a38f92a510dc94c0656a84bb51.tar.bz2
h5test.h testing macros get enclosed in do..while loops (#1721)
* h5test.h testing macros get enclosed in do..while loops * Adds missed macro in hl C++ code * Fixes macro in Windows code
Diffstat (limited to 'test/file_image.c')
-rw-r--r--test/file_image.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/test/file_image.c b/test/file_image.c
index 7f6a83e..45a2fa9 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -24,7 +24,7 @@
#define VERIFY(condition, string) \
do { \
if (!(condition)) \
- FAIL_PUTS_ERROR(string) \
+ FAIL_PUTS_ERROR(string); \
} while (0)
/* Values for callback bit field */
@@ -104,18 +104,18 @@ test_properties(void)
*/
size = (size_t)count * sizeof(char);
if (NULL == (buffer = (char *)HDmalloc(size)))
- TEST_ERROR
+ TEST_ERROR;
for (i = 0; i < count - 1; i++)
buffer[i] = (char)(65 + i);
buffer[count - 1] = '\0';
/* Create fapl */
if ((fapl_1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Get file image stuff */
if (H5Pget_file_image(fapl_1, (void **)&temp, &temp_size) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Check default values */
VERIFY(temp == NULL, "Default pointer is wrong");
@@ -123,11 +123,11 @@ test_properties(void)
/* Set file image stuff */
if (H5Pset_file_image(fapl_1, (void *)buffer, size) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Get the same */
if (H5Pget_file_image(fapl_1, (void **)&temp, &temp_size) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Check that sizes are the same, and that the buffers are identical but separate */
VERIFY(temp != NULL, "temp is null!");
@@ -137,11 +137,11 @@ test_properties(void)
/* Copy the fapl */
if ((fapl_2 = H5Pcopy(fapl_1)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Get values from the new fapl */
if (H5Pget_file_image(fapl_2, (void **)&temp2, &temp_size) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Check that sizes are the same, and that the buffers are identical but separate */
VERIFY(temp_size == size, "Sizes of buffers don't match");
@@ -367,12 +367,12 @@ test_callbacks(void)
/* Create fapl */
if ((fapl_1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Get file image stuff */
callbacks = real_callbacks;
if (H5Pget_file_image_callbacks(fapl_1, &callbacks) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Check default values */
VERIFY(callbacks.image_malloc == NULL, "Default malloc callback is wrong");
@@ -386,12 +386,12 @@ test_callbacks(void)
/* Set file image callbacks */
callbacks = real_callbacks;
if (H5Pset_file_image_callbacks(fapl_1, &callbacks) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Get file image callbacks */
callbacks = null_callbacks;
if (H5Pget_file_image_callbacks(fapl_1, &callbacks) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Verify values */
VERIFY(callbacks.image_malloc == &malloc_cb, "malloc callback was not set or retrieved properly");
@@ -409,7 +409,7 @@ test_callbacks(void)
/* Copy fapl */
reset_udata(udata);
if ((fapl_2 = H5Pcopy(fapl_1)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Verify that the property's copy callback used the correct image callbacks */
VERIFY(udata->used_callbacks == (UDATA_COPY), "Copying a fapl with no image used incorrect callbacks");
@@ -417,19 +417,19 @@ test_callbacks(void)
/* Close fapl */
reset_udata(udata);
if (H5Pclose(fapl_2) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Verify that the udata free callback was used */
VERIFY(udata->used_callbacks == (UDATA_FREE), "Closing a fapl with no image used incorrect callbacks");
/* Copy again */
if ((fapl_2 = H5Pcopy(fapl_1)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Remove property from fapl */
reset_udata(udata);
if (H5Premove(fapl_2, H5F_ACS_FILE_IMAGE_INFO_NAME) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Verify that the property's delete callback was called using the correct image callbacks */
VERIFY(udata->used_callbacks == (UDATA_FREE),
@@ -437,12 +437,12 @@ test_callbacks(void)
/* Close it again */
if (H5Pclose(fapl_2) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Get file image */
reset_udata(udata);
if (H5Pget_file_image(fapl_1, (void **)&temp_file_image, &temp_size) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Verify that the correct callbacks were used */
VERIFY(udata->used_callbacks == 0,
@@ -451,7 +451,7 @@ test_callbacks(void)
/* Set file image */
reset_udata(udata);
if (H5Pset_file_image(fapl_1, (void *)file_image, size) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
VERIFY(udata->used_callbacks == (MALLOC | MEMCPY),
"Setting a file image (first time) used incorrect callbacks");
@@ -463,7 +463,7 @@ test_callbacks(void)
/* Copy fapl */
reset_udata(udata);
if ((fapl_2 = H5Pcopy(fapl_1)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Verify that the property's copy callback used the correct image callbacks */
VERIFY(udata->used_callbacks == (MALLOC | MEMCPY | UDATA_COPY),
@@ -474,7 +474,7 @@ test_callbacks(void)
/* Close fapl */
reset_udata(udata);
if (H5Pclose(fapl_2) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Verify that the udata free callback was used */
VERIFY(udata->used_callbacks == (FREE | UDATA_FREE),
@@ -483,12 +483,12 @@ test_callbacks(void)
/* Copy again */
if ((fapl_2 = H5Pcopy(fapl_1)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Remove property from fapl */
reset_udata(udata);
if (H5Premove(fapl_2, H5F_ACS_FILE_IMAGE_INFO_NAME) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Verify that the property's delete callback was called using the correct image callbacks */
VERIFY(udata->used_callbacks == (FREE | UDATA_FREE),
@@ -497,12 +497,12 @@ test_callbacks(void)
/* Close it again */
if (H5Pclose(fapl_2) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Get file image */
reset_udata(udata);
if (H5Pget_file_image(fapl_1, (void **)&temp_file_image, &temp_size) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Verify that the correct callbacks were used */
VERIFY(udata->used_callbacks == (MALLOC | MEMCPY),
@@ -513,7 +513,7 @@ test_callbacks(void)
/* Set file image */
reset_udata(udata);
if (H5Pset_file_image(fapl_1, (void *)file_image, size) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
VERIFY(udata->used_callbacks == (FREE | MALLOC | MEMCPY),
"Setting a file image (second time) used incorrect callbacks");
@@ -523,7 +523,7 @@ test_callbacks(void)
/* Close stuff */
if (H5Pclose(fapl_1) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
HDfree(file_image);
HDfree(temp_file_image);
HDfree(udata);
@@ -670,13 +670,13 @@ test_core(void)
/* Set file image in plist */
if (H5Pset_file_image(fapl, file_image, size) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Test open with file image */
if ((file = H5Fopen("dne.h5", H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
if (H5Fclose(file) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
/* Release resources */
h5_clean_files(FILENAME, fapl);