summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2019-03-21 17:09:55 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2019-03-21 17:18:16 (GMT)
commit85e2214d55a3845ce78f2e4ff5f67b160d773dcb (patch)
treede7fe9f54ea8f9b639ccf96319d818bea33fe5c7 /test
parent97cdcc47e4291394d136121554f8d5130ab19bd4 (diff)
downloadhdf5-85e2214d55a3845ce78f2e4ff5f67b160d773dcb.zip
hdf5-85e2214d55a3845ce78f2e4ff5f67b160d773dcb.tar.gz
hdf5-85e2214d55a3845ce78f2e4ff5f67b160d773dcb.tar.bz2
Changes that show the right way to iterate over enums.
Diffstat (limited to 'test')
-rw-r--r--test/dtypes.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index a39603d..2056245 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -7627,7 +7627,10 @@ test_versionbounds(void)
H5F_t *filep = NULL; /* Pointer to internal structure of a file */
H5T_t *dtypep = NULL; /* Pointer to internal structure of a datatype */
hsize_t arr_dim[] = {ARRAY_LEN}; /* Length of the array */
+ int i, j; /* Indices for iterating over versions */
H5F_libver_t low, high; /* File format bounds */
+ H5F_libver_t versions[] = {H5F_LIBVER_EARLIEST, H5F_LIBVER_V18, H5F_LIBVER_V110};
+ int versions_count = 3; /* Number of version bounds in the array */
unsigned highest_version; /* Highest version in nested datatypes */
color_t enum_val; /* Enum type index */
herr_t ret = 0; /* Generic return value */
@@ -7691,19 +7694,19 @@ test_versionbounds(void)
ret = H5Tenum_insert(enum_type, "RED", &enum_val);
if (ret < 0) TEST_ERROR
- H5_INC_ENUM(color_t, enum_val);
+ enum_val = E1_GREEN;
ret = H5Tenum_insert(enum_type, "GREEN", &enum_val);
if (ret < 0) TEST_ERROR
- H5_INC_ENUM(color_t, enum_val);
+ enum_val = E1_BLUE;
ret = H5Tenum_insert(enum_type, "BLUE", &enum_val);
if (ret < 0) TEST_ERROR
- H5_INC_ENUM(color_t, enum_val);
+ enum_val = E1_ORANGE;
ret = H5Tenum_insert(enum_type, "ORANGE", &enum_val);
if (ret < 0) TEST_ERROR
- H5_INC_ENUM(color_t, enum_val);
+ enum_val = E1_YELLOW;
ret = H5Tenum_insert(enum_type, "YELLOW", &enum_val);
if (ret < 0) TEST_ERROR
@@ -7727,8 +7730,9 @@ test_versionbounds(void)
skipping invalid combinations */
/* Create the file, create and write to a dataset with compound datatype */
/* Verify the dataset's datatype and its members */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(i = 0, low = versions[i]; i < versions_count; i++) {
+
+ for(j = 0, high = versions[j]; j < versions_count; j++) {
/* Set version bounds */
H5E_BEGIN_TRY {