summaryrefslogtreecommitdiffstats
path: root/test/enum.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2011-05-27 21:13:25 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2011-05-27 21:13:25 (GMT)
commit596a38f5195ffb39cab325f47cc513961034a084 (patch)
tree143af597046fdb04e375c4e78de55d51712bd70f /test/enum.c
parent44e5d2a1d7a83b8196094a63f7023c514bcdae2a (diff)
downloadhdf5-596a38f5195ffb39cab325f47cc513961034a084.zip
hdf5-596a38f5195ffb39cab325f47cc513961034a084.tar.gz
hdf5-596a38f5195ffb39cab325f47cc513961034a084.tar.bz2
[svn-r20920] 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;