summaryrefslogtreecommitdiffstats
path: root/test/enum.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2011-05-27 17:30:24 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2011-05-27 17:30:24 (GMT)
commit157623de6a3970f68d725d9dda0974c0ef6f67cd (patch)
tree0b73f16bbc6c3d85c6340ed484af37b9943c1a98 /test/enum.c
parentde14c332f9dc8535d435e19a2a43e7f9f0ff0e80 (diff)
downloadhdf5-157623de6a3970f68d725d9dda0974c0ef6f67cd.zip
hdf5-157623de6a3970f68d725d9dda0974c0ef6f67cd.tar.gz
hdf5-157623de6a3970f68d725d9dda0974c0ef6f67cd.tar.bz2
[svn-r20913] Issue 7579 - The overflowing ENUM values are inconsistent. When no conversion is involved in reading or writing the
data, overflowing values are retained. When conversion happens, the values become -1. The conversion function puts -1 when overflow happens. I added two new dataset transfer property to control whether to fill 0xff in the destination data or convert to the destination data when overflow happens. The two new functions are H5Pset(get)_enum_conv_overflow. I also added test cases in enum.c and dtypes.c. Tested on jam, koala, and heiwa.
Diffstat (limited to 'test/enum.c')
-rw-r--r--test/enum.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/test/enum.c b/test/enum.c
index e9f607d..df3ae3d 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -26,11 +26,13 @@ const char *FILENAME[] = {
};
typedef enum {
- E1_RED,
- E1_GREEN,
- E1_BLUE,
- E1_WHITE,
- E1_BLACK
+ E1_ERROR = -1,
+ E1_RED = 0,
+ E1_GREEN = 1,
+ E1_BLUE = 2,
+ E1_WHITE = 3,
+ E1_BLACK = 4,
+ E1_NO_COLOR
} c_e1;
@@ -121,7 +123,12 @@ test_named(hid_t file)
* Monday, January 4, 1999
*
* Modifications:
- *
+ * Raymond Lu
+ * 26 May 2011
+ * I added a few overflowing values (beyond the range of enumerate
+ * values) to make sure the library retains these values. The
+ * test for overflowing values when conversion happens is in the
+ * test_conv_enum_2() of dtypes.c.
*-------------------------------------------------------------------------
*/
static int
@@ -132,7 +139,8 @@ test_noconv(hid_t file)
static c_e1 data1[]={E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,
E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED,
E1_RED, E1_BLUE, E1_GREEN, E1_BLACK, E1_WHITE,
- E1_RED, E1_WHITE, E1_GREEN, E1_GREEN, E1_BLUE};
+ E1_RED, E1_WHITE, E1_GREEN, E1_GREEN, E1_BLUE,
+ E1_ERROR, E1_ERROR, E1_NO_COLOR, E1_NO_COLOR, E1_NO_COLOR};
c_e1 data2[NELMTS(data1)];
hsize_t ds_size[1]={NELMTS(data1)};
size_t i;