summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2011-10-10 21:55:45 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2011-10-10 21:55:45 (GMT)
commit62b1372a038bca6ce0f5d121dd4170c691cacc99 (patch)
tree3f95e150ae9ce21c09291a8aada067a8172448ae /test
parent873e6aea8d401c95b01c8fc866638a9c44a92f69 (diff)
downloadhdf5-62b1372a038bca6ce0f5d121dd4170c691cacc99.zip
hdf5-62b1372a038bca6ce0f5d121dd4170c691cacc99.tar.gz
hdf5-62b1372a038bca6ce0f5d121dd4170c691cacc99.tar.bz2
[svn-r21508] Revoked svn check-ins 20913 and 20921 (fix for HDFFV-7579) pending a careful evaluation of enum conversion behavior.
Diffstat (limited to 'test')
-rw-r--r--test/dtypes.c107
-rw-r--r--test/enum.c23
2 files changed, 6 insertions, 124 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index f01e94e..7138823 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -4487,22 +4487,12 @@ error:
* Failure: number of errors
*
* Programmer: Robb Matzke, LLNL, 2003-06-09
- *
- * 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 no conversion happens is in
- * test_noconv of enum.c.
*-------------------------------------------------------------------------
*/
static int
test_conv_enum_2(void)
{
hid_t srctype=-1, dsttype=-1, oddsize=-1;
- hid_t dxpl_id=-1;
- hbool_t conv_overflow;
int *data=NULL, i, nerrors=0;
const char *mname[] = { "RED",
"GREEN",
@@ -4554,108 +4544,11 @@ test_conv_enum_2(void)
}
}
- /* Now make the source data overflow and see the conversion retain the original values by default.
- * The initialization makes the first 128 values be -1, -2, -3,..., -128. In hexadecimal,
- * they are 0xffffff, 0xfffffe, 0xfffffd,..., 0xffff7f. The rest values are between 0
- * and 127. */
- for (i=0; i<NTESTELEM; i++) {
- if(i > 127) {
- ((char*)data)[i*3+2] = i % 128;
- ((char*)data)[i*3+0] = 0;
- ((char*)data)[i*3+1] = 0;
- } else {
- ((char*)data)[i*3+2] = -(i+1);
- ((char*)data)[i*3+0] = -1;
- ((char*)data)[i*3+1] = -1;
- }
- }
-
- /* Convert to destination type */
- H5Tconvert(srctype, dsttype, (size_t)NTESTELEM, data, NULL, H5P_DEFAULT);
-
- /* Check results */
- for (i=0; i<NTESTELEM; i++) {
- if(i > 127) {
- if (data[i] != i%128) {
- if (!nerrors++) {
- H5_FAILED();
- printf("element %d is %d but should have been %d\n",
- i, data[i], i%128);
- }
- }
- } else {
- if (data[i] != -(i+1)) {
- if (!nerrors++) {
- H5_FAILED();
- printf("element %d is %d but should have been %d\n",
- i, data[i], -(i+1));
- }
- }
- }
- }
-
- /* Now make the source data overflow and set the property for handling overflowing data to fill them
- * them with 0xff (-1). The initialization makes the first 128 values be -1, -2, -3,..., -128. In
- * hexadecimal, they are 0xffffff, 0xfffffe, 0xfffffd,..., 0xffff7f. The next 128 values are 128 to
- * 255. The rest values are between 0 and 7. */
- for (i=0; i<NTESTELEM; i++) {
- if(i > 255) {
- ((char*)data)[i*3+2] = i % 8;
- ((char*)data)[i*3+0] = 0;
- ((char*)data)[i*3+1] = 0;
- } else if(i > 127) {
- ((char*)data)[i*3+2] = i;
- ((char*)data)[i*3+0] = 0;
- ((char*)data)[i*3+1] = 0;
-
- } else {
- ((char*)data)[i*3+2] = -(i+1);
- ((char*)data)[i*3+0] = -1;
- ((char*)data)[i*3+1] = -1;
- }
- }
-
- /* Set the property for handling overflowing data */
- dxpl_id = H5Pcreate(H5P_DATASET_XFER);
-
- /* First verify it's TRUE by default */
- H5Pget_enum_conv_overflow(dxpl_id, &conv_overflow);
- if(!conv_overflow)
- nerrors++;
-
- /* Then set it to FALSE */
- H5Pset_enum_conv_overflow(dxpl_id, FALSE);
-
- /* Convert to destination type */
- H5Tconvert(srctype, dsttype, (size_t)NTESTELEM, data, NULL, dxpl_id);
-
- /* Check results. All overflowing values should turn to -1. */
- for (i=0; i<NTESTELEM; i++) {
- if(i > 255) {
- if (data[i] != i%8) {
- if (!nerrors++) {
- H5_FAILED();
- printf("element %d is %d but should have been %d\n",
- i, data[i], i%8);
- }
- }
- } else {
- if (data[i] != -1) {
- if (!nerrors++) {
- H5_FAILED();
- printf("element %d is %d but should have been -1\n",
- i, data[i]);
- }
- }
- }
- }
-
/* Cleanup */
free(data);
H5Tclose(srctype);
H5Tclose(dsttype);
H5Tclose(oddsize);
- H5Pclose(dxpl_id);
/* Failure */
if (nerrors) {
diff --git a/test/enum.c b/test/enum.c
index df3ae3d..3684102 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -26,13 +26,11 @@ const char *FILENAME[] = {
};
typedef enum {
- E1_ERROR = -1,
- E1_RED = 0,
- E1_GREEN = 1,
- E1_BLUE = 2,
- E1_WHITE = 3,
- E1_BLACK = 4,
- E1_NO_COLOR
+ E1_RED,
+ E1_GREEN,
+ E1_BLUE,
+ E1_WHITE,
+ E1_BLACK
} c_e1;
@@ -121,14 +119,6 @@ test_named(hid_t file)
*
* Programmer: Robb Matzke
* 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
@@ -139,8 +129,7 @@ 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_ERROR, E1_ERROR, E1_NO_COLOR, E1_NO_COLOR, E1_NO_COLOR};
+ E1_RED, E1_WHITE, E1_GREEN, E1_GREEN, E1_BLUE};
c_e1 data2[NELMTS(data1)];
hsize_t ds_size[1]={NELMTS(data1)};
size_t i;