Skip to content

Commit

Permalink
Committing clang-format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Aug 2, 2023
1 parent 8fec3cc commit 0898041
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 38 deletions.
68 changes: 39 additions & 29 deletions vol_dataset_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2056,7 +2056,7 @@ test_create_dataset_creation_properties(void)
hid_t dset_id = H5I_INVALID_HID, dcpl_id = H5I_INVALID_HID;
hid_t dset_dtype = H5I_INVALID_HID, compact_dtype = H5I_INVALID_HID;
hid_t fspace_id = H5I_INVALID_HID, compact_fspace_id = H5I_INVALID_HID;
void *read_buf = NULL;
void *read_buf = NULL;

TESTING_MULTIPART("dataset creation properties");

Expand Down Expand Up @@ -2393,13 +2393,13 @@ test_create_dataset_creation_properties(void)
{
TESTING_2("fill values");

int int_fill_value = DATASET_FILL_VALUE_TEST_INT_FILL_VALUE;
int int_fill_value = DATASET_FILL_VALUE_TEST_INT_FILL_VALUE;
double double_fill_value = DATASET_FILL_VALUE_TEST_DOUBLE_FILL_VALUE;
void *val = NULL;

void *val = NULL;
size_t num_elems = 1;
hid_t type_id = H5I_INVALID_HID;
hid_t type_id = H5I_INVALID_HID;

if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILL_VALUES)) {
SKIPPED();
HDprintf(" dataset fill values are not supported by this VOL connector\n");
Expand All @@ -2413,13 +2413,16 @@ test_create_dataset_creation_properties(void)
PART_ERROR(DCPL_fill_value_test);
}

if (H5Pset_fill_value(dcpl_id, DATASET_FILL_VALUE_TEST_INT_TYPE, (const void *) &int_fill_value) < 0) {
if (H5Pset_fill_value(dcpl_id, DATASET_FILL_VALUE_TEST_INT_TYPE, (const void *)&int_fill_value) <
0) {
H5_FAILED();
HDprintf(" couldn't set integer fill value in property list");
PART_ERROR(DCPL_fill_value_test);
}

if ((dset_id = H5Dcreate(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME1, DATASET_FILL_VALUE_TEST_INT_TYPE, fspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) {
if ((dset_id =
H5Dcreate(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME1, DATASET_FILL_VALUE_TEST_INT_TYPE,
fspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) {
H5_FAILED();
HDprintf(" couldn't create dataset with integer fill value");
PART_ERROR(DCPL_fill_value_test);
Expand All @@ -2432,24 +2435,25 @@ test_create_dataset_creation_properties(void)
}

for (int i = 0; i < DATASET_CREATION_PROPERTIES_TEST_SHAPE_RANK; i++)
num_elems *= (size_t) dims[i];
num_elems *= (size_t)dims[i];

if ((read_buf = HDcalloc(num_elems, sizeof(DATASET_FILL_VALUE_TEST_INT_TYPE))) == NULL) {
H5_FAILED();
HDprintf(" couldn't allocate memory for read buffer");
PART_ERROR(DCPL_fill_value_test);
}

if (H5Dread(dset_id, DATASET_FILL_VALUE_TEST_INT_TYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) {
if (H5Dread(dset_id, DATASET_FILL_VALUE_TEST_INT_TYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) <
0) {
H5_FAILED();
HDprintf(" couldn't read from dataset");
PART_ERROR(DCPL_fill_value_test);
}

for (size_t i = 0; i < num_elems; i++) {
val = (int*)(read_buf) + i;
val = (int *)(read_buf) + i;

if (*(int*) val != DATASET_FILL_VALUE_TEST_INT_FILL_VALUE) {
if (*(int *)val != DATASET_FILL_VALUE_TEST_INT_FILL_VALUE) {
H5_FAILED();
HDprintf(" incorrect value read from dataset");
PART_ERROR(DCPL_fill_value_test);
Expand Down Expand Up @@ -2478,35 +2482,38 @@ test_create_dataset_creation_properties(void)
PART_ERROR(DCPL_fill_value_test);
}

if ((H5Pset_fill_value(dcpl_id, DATASET_FILL_VALUE_TEST_DOUBLE_TYPE, (const void*) &double_fill_value)) < 0) {
if ((H5Pset_fill_value(dcpl_id, DATASET_FILL_VALUE_TEST_DOUBLE_TYPE,
(const void *)&double_fill_value)) < 0) {
H5_FAILED();
HDprintf(" couldn't set double fill value in property list");
PART_ERROR(DCPL_fill_value_test);
}

if ((dset_id = H5Dcreate2(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME2, DATASET_FILL_VALUE_TEST_DOUBLE_TYPE, fspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) {
H5_FAILED();

if ((dset_id = H5Dcreate2(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME2,
DATASET_FILL_VALUE_TEST_DOUBLE_TYPE, fspace_id, H5P_DEFAULT, dcpl_id,
H5P_DEFAULT)) < 0) {
H5_FAILED();
HDprintf(" couldn't create dataset with double fill value");
PART_ERROR(DCPL_fill_value_test);
}


if ((read_buf = HDcalloc(num_elems, sizeof(DATASET_FILL_VALUE_TEST_DOUBLE_TYPE))) == NULL) {
H5_FAILED();
HDprintf(" couldn't allocate memory for read buffer");
PART_ERROR(DCPL_fill_value_test);
}

if (H5Dread(dset_id, DATASET_FILL_VALUE_TEST_DOUBLE_TYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) {
if (H5Dread(dset_id, DATASET_FILL_VALUE_TEST_DOUBLE_TYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
read_buf) < 0) {
H5_FAILED();
HDprintf(" couldn't read from dataset");
PART_ERROR(DCPL_fill_value_test);
}

for (size_t i = 0; i < num_elems; i++) {
val = (double*)(read_buf) + i;
val = (double *)(read_buf) + i;

if (*(double*) val != DATASET_FILL_VALUE_TEST_DOUBLE_FILL_VALUE) {
if (*(double *)val != DATASET_FILL_VALUE_TEST_DOUBLE_FILL_VALUE) {
H5_FAILED();
HDprintf(" incorrect value read from dataset");
PART_ERROR(DCPL_fill_value_test);
Expand Down Expand Up @@ -2534,7 +2541,7 @@ test_create_dataset_creation_properties(void)
HDprintf(" couldn't create dcpl");
PART_ERROR(DCPL_fill_value_test);
}

if ((type_id = H5Tcopy(H5T_C_S1)) < 0) {
H5_FAILED();
HDprintf(" couldn't copy string datatype");
Expand All @@ -2544,17 +2551,19 @@ test_create_dataset_creation_properties(void)
if ((H5Tset_size(type_id, DATASET_FILL_VALUE_TEST_STRING_SIZE)) < 0) {
H5_FAILED();
HDprintf(" couldn't set size of string datatype");
PART_ERROR(DCPL_fill_value_test);
PART_ERROR(DCPL_fill_value_test);
}

if ((H5Pset_fill_value(dcpl_id, type_id, (const void*) DATASET_FILL_VALUE_TEST_STRING_FILL_VALUE)) < 0) {
if ((H5Pset_fill_value(dcpl_id, type_id,
(const void *)DATASET_FILL_VALUE_TEST_STRING_FILL_VALUE)) < 0) {
H5_FAILED();
HDprintf(" couldn't set string fill value in property list");
PART_ERROR(DCPL_fill_value_test);
}

if ((dset_id = H5Dcreate2(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME3, type_id, fspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) {
H5_FAILED();

if ((dset_id = H5Dcreate2(group_id, DATASET_FILL_VALUE_TEST_DSET_NAME3, type_id, fspace_id,
H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) {
H5_FAILED();
HDprintf(" couldn't create dataset with string fill value");
PART_ERROR(DCPL_fill_value_test);
}
Expand All @@ -2572,9 +2581,10 @@ test_create_dataset_creation_properties(void)
}

for (size_t i = 0; i < num_elems; i++) {
char val_str[DATASET_FILL_VALUE_TEST_STRING_SIZE+ 1];
char val_str[DATASET_FILL_VALUE_TEST_STRING_SIZE + 1];

memcpy(val_str, ((char*) read_buf) + i * DATASET_FILL_VALUE_TEST_STRING_SIZE, DATASET_FILL_VALUE_TEST_STRING_SIZE);
memcpy(val_str, ((char *)read_buf) + i * DATASET_FILL_VALUE_TEST_STRING_SIZE,
DATASET_FILL_VALUE_TEST_STRING_SIZE);
val_str[DATASET_FILL_VALUE_TEST_STRING_SIZE] = '\0';

if (strcmp(val_str, DATASET_FILL_VALUE_TEST_STRING_FILL_VALUE)) {
Expand Down
18 changes: 9 additions & 9 deletions vol_dataset_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ int vol_dataset_test(void);
#define DATASET_PROPERTY_LIST_TEST_DSET_NAME3 "property_list_test_dataset3"
#define DATASET_PROPERTY_LIST_TEST_DSET_NAME4 "property_list_test_dataset4"

#define DATASET_FILL_VALUE_TEST_DSET_NAME1 "dataset_fill_value_test_dataset1"
#define DATASET_FILL_VALUE_TEST_DSET_NAME2 "dataset_fill_value_test_dataset2"
#define DATASET_FILL_VALUE_TEST_DSET_NAME3 "dataset_fill_value_test_dataset3"
#define DATASET_FILL_VALUE_TEST_INT_TYPE H5T_NATIVE_INT
#define DATASET_FILL_VALUE_TEST_INT_FILL_VALUE 1
#define DATASET_FILL_VALUE_TEST_DOUBLE_TYPE H5T_NATIVE_DOUBLE
#define DATASET_FILL_VALUE_TEST_DOUBLE_FILL_VALUE 2.002
#define DATASET_FILL_VALUE_TEST_STRING_FILL_VALUE "abcdefgh"
#define DATASET_FILL_VALUE_TEST_STRING_SIZE 8 /* No null terminator for fixed length string*/
#define DATASET_FILL_VALUE_TEST_DSET_NAME1 "dataset_fill_value_test_dataset1"
#define DATASET_FILL_VALUE_TEST_DSET_NAME2 "dataset_fill_value_test_dataset2"
#define DATASET_FILL_VALUE_TEST_DSET_NAME3 "dataset_fill_value_test_dataset3"
#define DATASET_FILL_VALUE_TEST_INT_TYPE H5T_NATIVE_INT
#define DATASET_FILL_VALUE_TEST_INT_FILL_VALUE 1
#define DATASET_FILL_VALUE_TEST_DOUBLE_TYPE H5T_NATIVE_DOUBLE
#define DATASET_FILL_VALUE_TEST_DOUBLE_FILL_VALUE 2.002
#define DATASET_FILL_VALUE_TEST_STRING_FILL_VALUE "abcdefgh"
#define DATASET_FILL_VALUE_TEST_STRING_SIZE 8 /* No null terminator for fixed length string*/

#define DATASET_SMALL_READ_TEST_ALL_DSET_SPACE_RANK 3
#define DATASET_SMALL_READ_TEST_ALL_DSET_DTYPESIZE sizeof(int)
Expand Down

0 comments on commit 0898041

Please sign in to comment.