summaryrefslogtreecommitdiffstats
path: root/hl/test
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2021-10-18 20:20:07 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2021-10-18 20:20:07 (GMT)
commit4c253cc332397a02cd172cb80d8d23d7161a485e (patch)
tree241a0c04bc7c1a19dbc846c8487d5ada84cb0fd9 /hl/test
parent7c5c0bb0f0e5d396b1a4afc2ed7797dcc7f0a0b0 (diff)
parentcc7c0eb910306b3e823867e8b9bb58204f0e1422 (diff)
downloadhdf5-4c253cc332397a02cd172cb80d8d23d7161a485e.zip
hdf5-4c253cc332397a02cd172cb80d8d23d7161a485e.tar.gz
hdf5-4c253cc332397a02cd172cb80d8d23d7161a485e.tar.bz2
Merge branch 'develop' into selection_io
Diffstat (limited to 'hl/test')
-rw-r--r--hl/test/COPYING13
-rw-r--r--hl/test/gen_test_ds.c2
-rw-r--r--hl/test/test_ds.c70
-rw-r--r--hl/test/test_file_image.c37
-rw-r--r--hl/test/test_image.c50
-rw-r--r--hl/test/test_ld.c25
-rw-r--r--hl/test/test_lite.c143
-rw-r--r--hl/test/test_packet.c8
-rw-r--r--hl/test/test_table.c46
9 files changed, 240 insertions, 154 deletions
diff --git a/hl/test/COPYING b/hl/test/COPYING
deleted file mode 100644
index 97969da..0000000
--- a/hl/test/COPYING
+++ /dev/null
@@ -1,13 +0,0 @@
-
- Copyright by The HDF Group and
- The Board of Trustees of the University of Illinois.
- All rights reserved.
-
- The files and subdirectories in this directory are part of HDF5.
- The full HDF5 copyright notice, including terms governing use,
- modification, and redistribution, is contained in the COPYING file
- which can be found at the root of the source code distribution tree
- or in https://www.hdfgroup.org/licenses. If you do
- not have access to either file, you may request a copy from
- help@hdfgroup.org.
-
diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c
index 368c083..a56e6cf 100644
--- a/hl/test/gen_test_ds.c
+++ b/hl/test/gen_test_ds.c
@@ -75,7 +75,7 @@ main(int argc, char **argv)
int nerrors = 0;
char filename[65];
- if (argc < 2) {
+ if (argc < 2 || !argv[0] || !argv[1]) {
HDprintf("Usage: gen_test [le | be]\n");
return 1;
}
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index 90110a4..964e13f 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -406,10 +406,10 @@ create_int_dataset(hid_t fid, const char *dsidx, int fulldims)
herr_t
create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldims)
{
- int rank = 4;
- int rankds = 1;
- hsize_t dims[4] = {DIM1_SIZE, DIM2_SIZE, DIM3_SIZE, DIM4_SIZE};
- long * buf;
+ int rank = 4;
+ int rankds = 1;
+ hsize_t dims[4] = {DIM1_SIZE, DIM2_SIZE, DIM3_SIZE, DIM4_SIZE};
+ long * buf = NULL;
hsize_t s1_dim[1] = {DIM1_SIZE};
hsize_t s2_dim[1] = {DIM2_SIZE};
hsize_t s3_dim[1] = {DIM3_SIZE};
@@ -431,49 +431,54 @@ create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldi
/* Allocate buffer */
if (NULL == (buf = (long *)HDmalloc(sizeof(long) * DIM1_SIZE * DIM2_SIZE * DIM3_SIZE * DIM4_SIZE)))
- return FAIL;
+ goto error;
/* make a dataset */
if (H5LTmake_dataset_long(fid, dsname, rank, dims, buf) >= 0) {
if (fulldims == 0) {
/* make a DS dataset for the first dimension */
if (create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
- return FAIL;
+ goto error;
/* make a DS dataset for the second dimension */
if (create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
- return FAIL;
+ goto error;
/* make a DS dataset for the third dimension */
if (create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
- return FAIL;
+ goto error;
/* make a DS dataset for the fourth dimension */
if (create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, NULL, NULL, NULL, NULL) < 0)
- return FAIL;
+ goto error;
}
else {
if (create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
- return FAIL;
+ goto error;
if (create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
- return FAIL;
+ goto error;
if (create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) <
0)
- return FAIL;
+ goto error;
if (create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, s41_wbuf, s42_wbuf, s43_wbuf,
s44_wbuf) < 0)
- return FAIL;
+ goto error;
}
}
else
- return FAIL;
+ goto error;
HDfree(buf);
return SUCCEED;
+
+error:
+ HDfree(buf);
+
+ return FAIL;
}
herr_t
@@ -3554,9 +3559,9 @@ verify_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
int ret = 0;
/* unused */
- dset = dset;
- dim = dim;
- visitor_data = visitor_data;
+ (void)dset;
+ (void)dim;
+ (void)visitor_data;
/* define a positive value for return value. This will cause the iterator to
immediately return that positive value, indicating short-circuit success
@@ -3602,8 +3607,8 @@ read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
char * data = (char *)visitor_data;
/* unused */
- dset = dset;
- dim = dim;
+ (void)dset;
+ (void)dim;
/* get space */
if ((sid = H5Dget_space(scale_id)) < 0)
@@ -3691,7 +3696,7 @@ match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor_data)
hsize_t storage_size;
/* Stop compiler from whining about "unused parameters" */
- visitor_data = visitor_data;
+ (void)visitor_data;
/*-------------------------------------------------------------------------
* get DID (dataset) space info
@@ -3740,7 +3745,10 @@ match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor_data)
return ret;
out:
- H5E_BEGIN_TRY { H5Sclose(sid); }
+ H5E_BEGIN_TRY
+ {
+ H5Sclose(sid);
+ }
H5E_END_TRY;
return FAIL;
}
@@ -3766,9 +3774,9 @@ static herr_t
op_continue(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
{
/* Stop compiler from whining about "unused parameters" */
- dset = dset;
- dim = dim;
- scale_id = scale_id;
+ (void)dset;
+ (void)dim;
+ (void)scale_id;
if (visitor_data != NULL) {
(*(int *)visitor_data)++;
@@ -3799,9 +3807,9 @@ static herr_t
op_stop(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data)
{
/* Stop compiler from whining about "unused parameters" */
- dset = dset;
- dim = dim;
- scale_id = scale_id;
+ (void)dset;
+ (void)dim;
+ (void)scale_id;
if (visitor_data != NULL) {
(*(int *)visitor_data)++;
@@ -4956,12 +4964,12 @@ read_data(const char *fname, int ndims, hsize_t *dims, float **buf)
}
for (i = 0, nelms = 1; i < ndims; i++) {
- if (fscanf(f, "%s %u", str, &j) && HDferror(f)) {
+ if (HDfscanf(f, "%s %u", str, &j) && HDferror(f)) {
HDprintf("fscanf error in file %s\n", data_file);
HDfclose(f);
return -1;
} /* end if */
- if (fscanf(f, "%d", &n) < 0 && HDferror(f)) {
+ if (HDfscanf(f, "%d", &n) < 0 && HDferror(f)) {
HDprintf("fscanf error in file %s\n", data_file);
HDfclose(f);
return -1;
@@ -4979,7 +4987,7 @@ read_data(const char *fname, int ndims, hsize_t *dims, float **buf)
}
for (j = 0; j < nelms; j++) {
- if (fscanf(f, "%f", &val) < 0 && HDferror(f)) {
+ if (HDfscanf(f, "%f", &val) < 0 && HDferror(f)) {
HDprintf("fscanf error in file %s\n", data_file);
HDfclose(f);
return -1;
@@ -5202,6 +5210,8 @@ test_attach_detach(void)
HL_TESTING2("permutations of attaching and detaching");
+ gid = var1_id = var2_id = var3_id = H5I_INVALID_HID;
+
if ((fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c
index c20112f..bde8adc 100644
--- a/hl/test/test_file_image.c
+++ b/hl/test/test_file_image.c
@@ -51,10 +51,10 @@
*-------------------------------------------------------------------------
*/
static int
-test_file_image(size_t open_images, size_t nflags, unsigned *flags)
+test_file_image(size_t open_images, size_t nflags, const unsigned *flags)
{
- hid_t * file_id, *dset_id, file_space, plist; /* HDF5 ids */
- hsize_t dims1[RANK] = {2, 3}; /* original dimension of datasets */
+ hid_t * file_id = NULL, *dset_id = NULL, file_space, plist; /* HDF5 ids */
+ hsize_t dims1[RANK] = {2, 3}; /* original dimension of datasets */
hsize_t max_dims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED};
int data1[6] = {1, 2, 3, 4, 5, 6}; /* original contents of dataset */
int data2[6] = {7, 8, 9, 10, 11, 12}; /* "wrong" contents of dataset */
@@ -63,10 +63,10 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
hsize_t dims4[RANK] = {3, 5}; /* extended dimensions of datasets */
int data4[15] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
/* extended contents of dataset */
- ssize_t * buf_size; /* pointer to array of buffer sizes */
- void ** buf_ptr; /* pointer to array of pointers to image buffers */
- char ** filename; /* pointer to array of pointers to filenames */
- unsigned * input_flags; /* pointer to array of flag combinations */
+ ssize_t * buf_size = NULL; /* pointer to array of buffer sizes */
+ void ** buf_ptr = NULL; /* pointer to array of pointers to image buffers */
+ char ** filename = NULL; /* pointer to array of pointers to filenames */
+ unsigned * input_flags = NULL; /* pointer to array of flag combinations */
size_t i, j, k, nrow, n_values;
herr_t status1;
void * handle_ptr = NULL; /* pointers to driver buffer */
@@ -85,7 +85,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
FAIL_PUTS_ERROR("malloc() failed");
/* allocate array to store the name of each of the open images */
- if (NULL == (filename = (char **)HDmalloc(sizeof(char *) * open_images)))
+ if (NULL == (filename = (char **)HDcalloc(1, sizeof(char *) * open_images)))
FAIL_PUTS_ERROR("malloc() failed");
/* allocate array to store the size of each of the open images */
@@ -110,6 +110,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
/* allocate name buffer for image i */
filename[i] = (char *)HDmalloc(sizeof(char) * 32);
+ if (!filename[i])
+ FAIL_PUTS_ERROR("HDmalloc() failed");
/* create file name */
HDsprintf(filename[i], "image_file%d.h5", (int)i);
@@ -232,6 +234,9 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
if (input_flags[i] & H5LT_FILE_IMAGE_OPEN_RW && !(input_flags[i] & H5LT_FILE_IMAGE_DONT_COPY)) {
void *tmp_ptr = HDmalloc((size_t)buf_size[i]);
+ if (!tmp_ptr)
+ FAIL_PUTS_ERROR("buffer allocation failed");
+
/* Copy vfd buffer to a temporary buffer */
HDmemcpy(tmp_ptr, (void *)*core_buf_ptr_ptr, (size_t)buf_size[i]);
/* Clear status_flags in the superblock for the vfd buffer: file locking is using status_flags
@@ -335,7 +340,10 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
VERIFY(status1 < 0, "H5Dwrite() should have failed");
/* extend dimensions of dataset */
- H5E_BEGIN_TRY { status1 = H5Dset_extent(dset_id[i], dims4); }
+ H5E_BEGIN_TRY
+ {
+ status1 = H5Dset_extent(dset_id[i], dims4);
+ }
H5E_END_TRY;
VERIFY(status1 < 0, "H5Dset_extent() should have failed");
@@ -522,6 +530,17 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
return 0;
error:
+ if (filename) {
+ for (i = 0; i < open_images; i++)
+ HDfree(filename[i]);
+ HDfree(filename);
+ }
+ HDfree(file_id);
+ HDfree(dset_id);
+ HDfree(buf_ptr);
+ HDfree(buf_size);
+ HDfree(input_flags);
+
H5_FAILED();
return -1;
}
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index b71531e..81340c1 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -301,7 +301,10 @@ out:
HDfree(buf1_out);
if (buf2_out)
HDfree(buf2_out);
- H5E_BEGIN_TRY { H5Fclose(fid); }
+ H5E_BEGIN_TRY
+ {
+ H5Fclose(fid);
+ }
H5E_END_TRY;
H5_FAILED();
return FAIL;
@@ -488,7 +491,10 @@ out:
if (image_data)
HDfree(image_data);
- H5E_BEGIN_TRY { H5Fclose(fid); }
+ H5E_BEGIN_TRY
+ {
+ H5Fclose(fid);
+ }
H5E_END_TRY;
H5_FAILED();
@@ -574,11 +580,11 @@ test_generate(void)
!
*/
- if (fscanf(f, "%d %d %d", &imax, &jmax, &kmax) < 0 && HDferror(f)) {
+ if (HDfscanf(f, "%d %d %d", &imax, &jmax, &kmax) < 0 && HDferror(f)) {
HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
- if (fscanf(f, "%f %f %f", &valex, &xmin, &xmax) < 0 && HDferror(f)) {
+ if (HDfscanf(f, "%f %f %f", &valex, &xmin, &xmax) < 0 && HDferror(f)) {
HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
@@ -609,7 +615,7 @@ test_generate(void)
goto out;
for (i = 0; i < n_elements; i++) {
- if (fscanf(f, "%f ", &value) < 0 && HDferror(f)) {
+ if (HDfscanf(f, "%f ", &value) < 0 && HDferror(f)) {
HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
@@ -644,10 +650,10 @@ test_generate(void)
HL_TESTING2("make indexed image from land data");
for (i = 0; i < n_elements; i++) {
- if (data[i] < 0)
+ if (data[i] < 0.0f)
image_data[i] = 0;
else
- image_data[i] = (unsigned char)((255 * (data[i])) / xmax);
+ image_data[i] = (unsigned char)((255 * data[i]) / xmax);
}
/* make the image */
@@ -665,10 +671,11 @@ test_generate(void)
HL_TESTING2("make indexed image from sea data");
for (i = 0; i < n_elements; i++) {
- if (data[i] > 0)
+ if (data[i] > 0.0f)
image_data[i] = 0;
- else
- image_data[i] = (unsigned char)((255 * (data[i] - xmin)) / xmin);
+ else {
+ image_data[i] = (unsigned char)((255.0f * (data[i] - xmin)) / (xmax - xmin));
+ }
}
/* make the image */
@@ -720,7 +727,10 @@ out:
if (image_data)
HDfree(image_data);
- H5E_BEGIN_TRY { H5Fclose(fid); }
+ H5E_BEGIN_TRY
+ {
+ H5Fclose(fid);
+ }
H5E_END_TRY;
if (f)
HDfclose(f);
@@ -769,32 +779,32 @@ read_data(const char *fname, /*IN*/
goto out;
}
- if (fscanf(f, "%s", str) < 0 && HDferror(f)) {
+ if (HDfscanf(f, "%s", str) < 0 && HDferror(f)) {
HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
- if (fscanf(f, "%d", &color_planes) < 0 && HDferror(f)) {
+ if (HDfscanf(f, "%d", &color_planes) < 0 && HDferror(f)) {
HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
- if (fscanf(f, "%s", str) < 0 && HDferror(f)) {
+ if (HDfscanf(f, "%s", str) < 0 && HDferror(f)) {
HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
- if (fscanf(f, "%d", &h) < 0 && HDferror(f)) {
+ if (HDfscanf(f, "%d", &h) < 0 && HDferror(f)) {
HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
- if (fscanf(f, "%s", str) < 0 && HDferror(f)) {
+ if (HDfscanf(f, "%s", str) < 0 && HDferror(f)) {
HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
- if (fscanf(f, "%d", &w) < 0 && HDferror(f)) {
+ if (HDfscanf(f, "%d", &w) < 0 && HDferror(f)) {
HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
@@ -828,7 +838,7 @@ read_data(const char *fname, /*IN*/
/* Read data elements */
for (i = 0; i < n_elements; i++) {
- if (fscanf(f, "%d", &n) < 0 && HDferror(f)) {
+ if (HDfscanf(f, "%d", &n) < 0 && HDferror(f)) {
HDprintf("fscanf error in file %s.\n", data_file);
goto out;
} /* end if */
@@ -926,7 +936,7 @@ read_palette(const char *fname, rgb_t *palette, size_t palette_size)
return -1;
}
- if (sscanf(buffer, "%u", &nentries) != 1) {
+ if (HDsscanf(buffer, "%u", &nentries) != 1) {
HDfclose(file);
return -1;
}
@@ -940,7 +950,7 @@ read_palette(const char *fname, rgb_t *palette, size_t palette_size)
/* read the palette entries */
for (u = 0; u < nentries; u++) {
/* extract the red, green and blue color components. */
- if (fscanf(file, "%u %u %u", &red, &green, &blue) != 3) {
+ if (HDfscanf(file, "%u %u %u", &red, &green, &blue) != 3) {
HDfclose(file);
return -1;
}
diff --git a/hl/test/test_ld.c b/hl/test/test_ld.c
index 06cb600..dc5755c 100644
--- a/hl/test/test_ld.c
+++ b/hl/test/test_ld.c
@@ -157,7 +157,8 @@ static herr_t test_LD_elmts_invalid(const char *file);
static herr_t test_LD_elmts_one(const char *file, const char *dname, const char *fields);
static herr_t test_LD_elmts_two(const char *file, const char *dname, const char *fields);
-static herr_t verify_elmts_two(int type, hsize_t *ext_dims, hsize_t *prev_dims, void *_ldbuf, void *_buf);
+static herr_t verify_elmts_two(int type, const hsize_t *ext_dims, const hsize_t *prev_dims, void *_ldbuf,
+ void *_buf);
/* data structures for compound data type */
typedef struct sub22_t {
@@ -251,7 +252,10 @@ test_LD_dims_params(const char *file)
/*
* 1. Verify failure with negative dataset id
*/
- H5E_BEGIN_TRY { ret = H5LDget_dset_dims(invalid_id, one_cur_dims); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5LDget_dset_dims(invalid_id, one_cur_dims);
+ }
H5E_END_TRY;
VERIFY_EQUAL(ret, FAIL)
@@ -260,7 +264,10 @@ test_LD_dims_params(const char *file)
*/
if ((did = H5Dopen2(fid, DSET_ALLOC_EARLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY { ret = H5LDget_dset_dims(did, NULL); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5LDget_dset_dims(did, NULL);
+ }
H5E_END_TRY;
VERIFY_EQUAL(ret, FAIL)
if (H5Dclose(did) < 0)
@@ -535,7 +542,10 @@ test_LD_size(const char *file)
/*
* Verify failure with an invalid dataset id
*/
- H5E_BEGIN_TRY { dsize = H5LDget_dset_type_size(invalid_id, NULL); }
+ H5E_BEGIN_TRY
+ {
+ dsize = H5LDget_dset_type_size(invalid_id, NULL);
+ }
H5E_END_TRY;
VERIFY_EQUAL(dsize, 0)
@@ -915,7 +925,10 @@ test_LD_elmts_invalid(const char *file)
*/
/* Verify failure from case #1: an invalid dataset id */
- H5E_BEGIN_TRY { ret = H5LDget_dset_elmts(invalid_id, prev_dims, cur_dims, NULL, tbuf); }
+ H5E_BEGIN_TRY
+ {
+ ret = H5LDget_dset_elmts(invalid_id, prev_dims, cur_dims, NULL, tbuf);
+ }
H5E_END_TRY;
VERIFY_EQUAL(ret, FAIL)
@@ -1135,7 +1148,7 @@ error:
**************************************************************************************
*/
static herr_t
-verify_elmts_two(int type, hsize_t *ext_dims, hsize_t *prev_dims, void *_ldbuf, void *_buf)
+verify_elmts_two(int type, const hsize_t *ext_dims, const hsize_t *prev_dims, void *_ldbuf, void *_buf)
{
int k, m; /* Local index variable */
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c
index 52cda54..53f834a 100644
--- a/hl/test/test_lite.c
+++ b/hl/test/test_lite.c
@@ -43,8 +43,9 @@
#define ATTR7_NAME "attr ushort"
#define ATTR8_NAME "attr uint"
#define ATTR9_NAME "attr ulong"
-#define ATTR10_NAME "attr float"
-#define ATTR11_NAME "attr double"
+#define ATTR10_NAME "attr ullong"
+#define ATTR11_NAME "attr float"
+#define ATTR12_NAME "attr double"
static herr_t make_attributes(hid_t loc_id, const char *obj_name);
@@ -472,28 +473,30 @@ make_attributes(hid_t loc_id, const char *obj_name)
size_t type_size;
int i;
- char attr_str_in[] = {"My attribute"};
- char attr_str_out[20];
- char attr_char_in[5] = {1, 2, 3, 4, 5};
- char attr_char_out[5];
- short attr_short_in[5] = {1, 2, 3, 4, 5};
- short attr_short_out[5];
- int attr_int_in[5] = {1, 2, 3, 4, 5};
- int attr_int_out[5];
- long attr_long_in[5] = {1, 2, 3, 4, 5};
- long attr_long_out[5];
- float attr_float_in[5] = {1, 2, 3, 4, 5};
- float attr_float_out[5];
- double attr_double_in[5] = {1, 2, 3, 4, 5};
- double attr_double_out[5];
- unsigned char attr_uchar_in[5] = {1, 2, 3, 4, 5};
- unsigned char attr_uchar_out[5];
- unsigned short attr_ushort_in[5] = {1, 2, 3, 4, 5};
- unsigned short attr_ushort_out[5];
- unsigned int attr_uint_in[5] = {1, 2, 3, 4, 5};
- unsigned int attr_uint_out[5];
- unsigned long attr_ulong_in[5] = {1, 2, 3, 4, 5};
- unsigned long attr_ulong_out[5];
+ char attr_str_in[] = {"My attribute"};
+ char attr_str_out[20];
+ char attr_char_in[5] = {1, 2, 3, 4, 5};
+ char attr_char_out[5];
+ short attr_short_in[5] = {1, 2, 3, 4, 5};
+ short attr_short_out[5];
+ int attr_int_in[5] = {1, 2, 3, 4, 5};
+ int attr_int_out[5];
+ long attr_long_in[5] = {1, 2, 3, 4, 5};
+ long attr_long_out[5];
+ float attr_float_in[5] = {1, 2, 3, 4, 5};
+ float attr_float_out[5];
+ double attr_double_in[5] = {1, 2, 3, 4, 5};
+ double attr_double_out[5];
+ unsigned char attr_uchar_in[5] = {1, 2, 3, 4, 5};
+ unsigned char attr_uchar_out[5];
+ unsigned short attr_ushort_in[5] = {1, 2, 3, 4, 5};
+ unsigned short attr_ushort_out[5];
+ unsigned int attr_uint_in[5] = {1, 2, 3, 4, 5};
+ unsigned int attr_uint_out[5];
+ unsigned long attr_ulong_in[5] = {1, 2, 3, 4, 5};
+ unsigned long attr_ulong_out[5];
+ unsigned long long attr_ullong_in[5] = {1, 2, 3, 4, 5};
+ unsigned long long attr_ullong_out[5];
/*-------------------------------------------------------------------------
* H5LTset_attribute_string test
@@ -509,7 +512,7 @@ make_attributes(hid_t loc_id, const char *obj_name)
PASSED();
/*-------------------------------------------------------------------------
- * H5LTset_attribute_string test
+ * H5LTget_attribute_string test
*-------------------------------------------------------------------------
*/
@@ -859,7 +862,7 @@ make_attributes(hid_t loc_id, const char *obj_name)
PASSED();
/*-------------------------------------------------------------------------
- * H5LTget_attribute_long test
+ * H5LTget_attribute_ulong test
*-------------------------------------------------------------------------
*/
@@ -888,6 +891,48 @@ make_attributes(hid_t loc_id, const char *obj_name)
PASSED();
/*-------------------------------------------------------------------------
+ * H5LTset_attribute_ullong test
+ *-------------------------------------------------------------------------
+ */
+
+ HL_TESTING2("H5LTset_attribute_ullong");
+
+ /* Set the attribute */
+ if (H5LTset_attribute_ullong(loc_id, obj_name, ATTR10_NAME, attr_ullong_in, (size_t)5) < 0)
+ return -1;
+
+ PASSED();
+
+ /*-------------------------------------------------------------------------
+ * H5LTget_attribute_ullong test
+ *-------------------------------------------------------------------------
+ */
+
+ HL_TESTING2("H5LTget_attribute_ullong");
+
+ /* Get the attribute */
+ if (H5LTget_attribute_ullong(loc_id, obj_name, ATTR10_NAME, attr_ullong_out) < 0)
+ return -1;
+
+ for (i = 0; i < 5; i++) {
+ if (attr_ullong_in[i] != attr_ullong_out[i]) {
+ return -1;
+ }
+ }
+
+ /* Get the attribute */
+ if (H5LTget_attribute(loc_id, obj_name, ATTR10_NAME, H5T_NATIVE_ULLONG, attr_ullong_out) < 0)
+ return -1;
+
+ for (i = 0; i < 5; i++) {
+ if (attr_ullong_in[i] != attr_ullong_out[i]) {
+ return -1;
+ }
+ }
+
+ PASSED();
+
+ /*-------------------------------------------------------------------------
* H5LTset_attribute_float test
*-------------------------------------------------------------------------
*/
@@ -895,7 +940,7 @@ make_attributes(hid_t loc_id, const char *obj_name)
HL_TESTING2("H5LTset_attribute_float");
/* Set the attribute */
- if (H5LTset_attribute_float(loc_id, obj_name, ATTR10_NAME, attr_float_in, (size_t)5) < 0)
+ if (H5LTset_attribute_float(loc_id, obj_name, ATTR11_NAME, attr_float_in, (size_t)5) < 0)
return -1;
PASSED();
@@ -908,7 +953,7 @@ make_attributes(hid_t loc_id, const char *obj_name)
HL_TESTING2("H5LTget_attribute_float");
/* Get the attribute */
- if (H5LTget_attribute_float(loc_id, obj_name, ATTR10_NAME, attr_float_out) < 0)
+ if (H5LTget_attribute_float(loc_id, obj_name, ATTR11_NAME, attr_float_out) < 0)
return -1;
for (i = 0; i < 5; i++) {
@@ -918,7 +963,7 @@ make_attributes(hid_t loc_id, const char *obj_name)
}
/* Get the attribute */
- if (H5LTget_attribute(loc_id, obj_name, ATTR10_NAME, H5T_NATIVE_FLOAT, attr_float_out) < 0)
+ if (H5LTget_attribute(loc_id, obj_name, ATTR11_NAME, H5T_NATIVE_FLOAT, attr_float_out) < 0)
return -1;
for (i = 0; i < 5; i++) {
@@ -937,7 +982,7 @@ make_attributes(hid_t loc_id, const char *obj_name)
HL_TESTING2("H5LTset_attribute_double");
/* Set the attribute */
- if (H5LTset_attribute_double(loc_id, obj_name, ATTR11_NAME, attr_double_in, (size_t)5) < 0)
+ if (H5LTset_attribute_double(loc_id, obj_name, ATTR12_NAME, attr_double_in, (size_t)5) < 0)
return -1;
PASSED();
@@ -950,7 +995,7 @@ make_attributes(hid_t loc_id, const char *obj_name)
HL_TESTING2("H5LTget_attribute_double");
/* Get the attribute */
- if (H5LTget_attribute_double(loc_id, obj_name, ATTR11_NAME, attr_double_out) < 0)
+ if (H5LTget_attribute_double(loc_id, obj_name, ATTR12_NAME, attr_double_out) < 0)
return -1;
for (i = 0; i < 5; i++) {
@@ -960,7 +1005,7 @@ make_attributes(hid_t loc_id, const char *obj_name)
}
/* Get the attribute */
- if (H5LTget_attribute(loc_id, obj_name, ATTR11_NAME, H5T_NATIVE_DOUBLE, attr_double_out) < 0)
+ if (H5LTget_attribute(loc_id, obj_name, ATTR12_NAME, H5T_NATIVE_DOUBLE, attr_double_out) < 0)
return -1;
for (i = 0; i < 5; i++) {
@@ -1054,7 +1099,7 @@ test_integers(void)
HDfree(dt_str);
goto out;
}
- if (HDstrcmp(dt_str, "H5T_STD_I8BE")) {
+ if (HDstrcmp(dt_str, "H5T_STD_I8BE") != 0) {
HDfree(dt_str);
goto out;
}
@@ -1112,7 +1157,7 @@ test_fps(void)
HDfree(dt_str);
goto out;
}
- if (HDstrcmp(dt_str, "H5T_IEEE_F32BE")) {
+ if (HDstrcmp(dt_str, "H5T_IEEE_F32BE") != 0) {
HDfree(dt_str);
goto out;
}
@@ -1184,7 +1229,7 @@ test_strings(void)
goto out;
}
if (HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE 13;\n STRPAD H5T_STR_NULLTERM;\n CSET "
- "H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) {
+ "H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }") != 0) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
@@ -1219,7 +1264,7 @@ test_strings(void)
goto out;
}
if (HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n "
- "CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) {
+ "CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }") != 0) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
@@ -1238,7 +1283,7 @@ test_strings(void)
if (HDstrncmp(dt_str,
"H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET "
"H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }",
- str_len - 1)) {
+ str_len - 1) != 0) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
@@ -1261,7 +1306,7 @@ test_strings(void)
if (HDstrncmp(dt_str,
"H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET "
"H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }",
- str_len)) {
+ str_len) != 0) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
@@ -1322,7 +1367,8 @@ test_opaques(void)
}
if (HDstrcmp(
dt_str,
- "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }")) {
+ "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }") !=
+ 0) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
@@ -1376,7 +1422,7 @@ test_enums(void)
if (H5Tenum_nameof(dtype, &value1, name1, size) < 0)
goto out;
- if (HDstrcmp(name1, "BLUE"))
+ if (HDstrcmp(name1, "BLUE") != 0)
goto out;
if (H5Tenum_valueof(dtype, name2, &value2) < 0)
@@ -1399,8 +1445,9 @@ test_enums(void)
HDfree(dt_str);
goto out;
}
- if (HDstrcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" "
- " 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) {
+ if (HDstrcmp(dt_str,
+ "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" "
+ " 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }") != 0) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
@@ -1462,7 +1509,7 @@ test_variables(void)
HDfree(dt_str);
goto out;
}
- if (HDstrcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) {
+ if (HDstrcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }") != 0) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
@@ -1526,7 +1573,7 @@ test_arrays(void)
}
if (HDstrcmp(dt_str, "H5T_ARRAY {\n [5][7][13] H5T_ARRAY {\n [17][19] H5T_COMPOUND {\n "
" H5T_STD_I8BE \"arr_compound_1\" : 0;\n H5T_STD_I32BE "
- "\"arr_compound_2\" : 1;\n }\n }\n }")) {
+ "\"arr_compound_2\" : 1;\n }\n }\n }") != 0) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
@@ -1586,7 +1633,7 @@ test_compounds(void)
goto out;
}
if (HDstrcmp(dt_str, "H5T_COMPOUND {\n H5T_STD_I16BE \"one_field\" : 2;\n H5T_STD_U8LE "
- "\"two_field\" : 6;\n }")) {
+ "\"two_field\" : 6;\n }") != 0) {
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
@@ -1605,7 +1652,7 @@ test_compounds(void)
if ((memb_name = H5Tget_member_name(dtype, 1)) == NULL)
goto out;
- if (HDstrcmp(memb_name, "i16_field")) {
+ if (HDstrcmp(memb_name, "i16_field") != 0) {
H5free_memory(memb_name);
goto out;
}
@@ -1683,7 +1730,7 @@ test_compound_bug(void)
if ((memb_name = H5Tget_member_name(dtype, 2)) == NULL)
goto out;
- if (HDstrcmp(memb_name, "sub")) {
+ if (HDstrcmp(memb_name, "sub") != 0) {
H5free_memory(memb_name);
goto out;
}
@@ -1720,7 +1767,7 @@ test_compound_bug(void)
if ((memb_name = H5Tget_member_name(dtype, 1)) == NULL)
goto out;
if (HDstrcmp(memb_name, "desc____________________________________________________________________________"
- "_____________")) {
+ "_____________") != 0) {
H5free_memory(memb_name);
goto out;
}
diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c
index 1d3a569..5f30d4b 100644
--- a/hl/test/test_packet.c
+++ b/hl/test/test_packet.c
@@ -45,10 +45,10 @@ typedef struct particle_t {
* a static array of particles for writing and checking reads
*-------------------------------------------------------------------------
*/
-static particle_t testPart[NRECORDS] = {{"zero", 0, 0, 0.0f, 0.0f}, {"one", 10, 10, 1.0f, 10.0f},
- {"two", 20, 20, 2.0f, 20.0f}, {"three", 30, 30, 3.0f, 30.0f},
- {"four", 40, 40, 4.0f, 40.0f}, {"five", 50, 50, 5.0f, 50.0f},
- {"six", 60, 60, 6.0f, 60.0f}, {"seven", 70, 70, 7.0f, 70.0f}};
+static particle_t testPart[NRECORDS] = {{"zero", 0, 0, 0.0F, 0.0}, {"one", 10, 10, 1.0F, 10.0},
+ {"two", 20, 20, 2.0F, 20.0}, {"three", 30, 30, 3.0F, 30.0},
+ {"Four", 40, 40, 4.0F, 40.0}, {"Five", 50, 50, 5.0F, 50.0},
+ {"six", 60, 60, 6.0F, 60.0}, {"seven", 70, 70, 7.0F, 70.0}};
/*-------------------------------------------------------------------------
* function that compares one particle
diff --git a/hl/test/test_table.c b/hl/test/test_table.c
index 0d4a72a..6199e27 100644
--- a/hl/test/test_table.c
+++ b/hl/test/test_table.c
@@ -199,7 +199,7 @@ test_table(hid_t fid, int do_write)
hsize_t chunk_size = 10;
int compress = 0;
int * fill = NULL;
- particle_t fill1[1] = {{"no data", -1, -99.0f, -99.0f, -1}};
+ particle_t fill1[1] = {{"no data", -1, -99.0, -99.0, -1}};
int fill1_new[1] = {-100};
hsize_t position;
char tname[20];
@@ -227,25 +227,25 @@ test_table(hid_t fid, int do_write)
particle2_t rbuf2[NRECORDS];
particle3_t rbuf3[NRECORDS];
particle_t rbufc[NRECORDS * 2];
- particle_t abuf[2] = {{"eight", 80, 8.0f, 80.0f, 80}, {"nine", 90, 9.0f, 90.0f, 90}};
- particle_t ibuf[2] = {{"zero", 0, 0.0f, 0.0f, 0}, {"zero", 0, 0.0f, 0.0f, 0}};
+ particle_t abuf[2] = {{"eight", 80, 8.0, 80.0, 80}, {"nine", 90, 9.0, 90.0, 90}};
+ particle_t ibuf[2] = {{"zero", 0, 0.0, 0.0, 0}, {"zero", 0, 0.0, 0.0, 0}};
particle_t wbufd[NRECORDS];
particle_t wbuf[NRECORDS] = {{
"zero",
0,
- 0.0f,
- 0.0f,
+ 0.0,
+ 0.0,
0,
},
- {"one", 10, 1.0f, 10.0f, 10},
- {"two", 20, 2.0f, 20.0f, 20},
- {"three", 30, 3.0f, 30.0f, 30},
- {"four", 40, 4.0f, 40.0f, 40},
- {"five", 50, 5.0f, 50.0f, 50},
- {"six", 60, 6.0f, 60.0f, 60},
- {"seven", 70, 7.0f, 70.0f, 70}};
+ {"one", 10, 1.0, 10.0, 10},
+ {"two", 20, 2.0, 20.0, 20},
+ {"three", 30, 3.0, 30.0, 30},
+ {"four", 40, 4.0, 40.0, 40},
+ {"five", 50, 5.0, 50.0, 50},
+ {"six", 60, 6.0, 60.0, 60},
+ {"seven", 70, 7.0, 70.0, 70}};
/* buffers for the field "Pressure" and "New_field" */
- float pressure_in[NRECORDS] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f};
+ float pressure_in[NRECORDS] = {0.0F, 1.0F, 2.0F, 3.0F, 4.0F, 5.0F, 6.0F, 7.0F};
float pressure_out[NRECORDS];
int buf_new[NRECORDS] = {0, 1, 2, 3, 4, 5, 6, 7};
/* buffers for the fields "Latitude,Longitude" */
@@ -254,8 +254,8 @@ test_table(hid_t fid, int do_write)
/* buffers for the fields "Name,Pressure" */
namepressure_t namepre_out[NRECORDS];
namepressure_t namepre_in[NRECORDS] = {
- {"zero", 0.0f}, {"one", 1.0f}, {"two", 2.0f}, {"three", 3.0f},
- {"four", 4.0f}, {"five", 5.0f}, {"six", 6.0f}, {"seven", 7.0f},
+ {"zero", 0.0F}, {"one", 1.0F}, {"two", 2.0F}, {"three", 3.0F},
+ {"four", 4.0F}, {"five", 5.0F}, {"six", 6.0F}, {"seven", 7.0F},
};
/*-------------------------------------------------------------------------
@@ -332,14 +332,14 @@ test_table(hid_t fid, int do_write)
HOFFSET(particle4_t, aty), HOFFSET(particle4_t, rro)};
/* Define an array of Particles */
- particle4_t p_data[NRECORDS] = {{12112, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
- {12113, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
- {12114, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
- {12115, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
- {12116, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
- {12117, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
- {12118, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}},
- {12119, 1.4f, 2.5f, {1, 2, 3}, {4, 5, 6}, {99, 100}}};
+ particle4_t p_data[NRECORDS] = {{12112, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12113, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12114, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12115, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12116, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12117, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12118, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}},
+ {12119, 1.4, 2.5, {1, 2, 3}, {4, 5, 6}, {99, 100}}};
/*-------------------------------------------------------------------------
* initialize table parameters