summaryrefslogtreecommitdiffstats
path: root/tools/h5diff
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-03-04 00:27:40 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-03-04 00:27:40 (GMT)
commit5b294640c003dac45c2cc489793950207bf63c8f (patch)
treeef451f922a5242888c2cd63552212fa278284162 /tools/h5diff
parentdc059968de3823ffa1b0008c14b7e7e46c1fb8d8 (diff)
parent6ee9ea656fad6f408e81bd995eb465e0dd4ce0db (diff)
downloadhdf5-5b294640c003dac45c2cc489793950207bf63c8f.zip
hdf5-5b294640c003dac45c2cc489793950207bf63c8f.tar.gz
hdf5-5b294640c003dac45c2cc489793950207bf63c8f.tar.bz2
[svn-r26350] Merge of r26273-26348 from the trunk.
Tested on: h5committest
Diffstat (limited to 'tools/h5diff')
-rw-r--r--tools/h5diff/h5diffgentest.c160
1 files changed, 83 insertions, 77 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 80405e9..1b80317 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -317,10 +317,10 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*/
{
- double data1[3][2] = {{1,1}, {1,1}, {0,0}};
- double data2[3][2] = {{0,1.1},{1.01,1.001},{0,1}};
- double data3[3][2] = {{100,100},{100,100},{100,100}};
- double data4[3][2] = {{105,120},{160,95},{80,40}};
+ double data1[3][2] = {{ 1.0F, 1.0F}, { 1.00F, 1.000F}, { 0.0F, 0.0F}};
+ double data2[3][2] = {{ 0.0F, 1.1F}, { 1.01F, 1.001F}, { 0.0F, 1.0F}};
+ double data3[3][2] = {{100.0F, 100.0F}, {100.00F, 100.000F}, {100.0F, 100.0F}};
+ double data4[3][2] = {{105.0F, 120.0F}, {160.00F, 95.000F}, { 80.0F, 40.0F}};
write_dset(gid1,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data1);
write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_DOUBLE,data2);
@@ -371,8 +371,8 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- double data9[3][2] = {{100,100},{100,0},{0,100}};
- double data10[3][2] ={{120,80}, {0,100},{0,50}};
+ double data9[3][2] = {{100.0F, 100.0F}, {100.0F, 0.0F}, {0.0F, 100.0F}};
+ double data10[3][2] ={{120.0F, 80.0F}, { 0.0F, 100.0F}, {0.0F, 50.0F}};
write_dset(gid1,2,dims2,"dset9",H5T_NATIVE_DOUBLE,data9);
write_dset(gid1,2,dims2,"dset10",H5T_NATIVE_DOUBLE,data10);
@@ -393,8 +393,14 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
/* epsilon = 0.0000000000000001 = 1e-16
* system epsilon for double : DBL_EPSILON = 2.22045E-16
*/
- double data13[3][2] ={{0.0000000000000000, 0.0000000000000001},{0.0000000000000001, 0.0000000000000000},{0.00000000000000033, 0.0000000000000001}};
- double data14[3][2] ={{0.0000000000000000, 0.0000000000000004},{0.0000000000000002, 0.0000000000000001},{0.0000000000000001, 0.00000000000000000}};
+ double data13[3][2] ={
+ {H5_DOUBLE(0.0000000000000000), H5_DOUBLE(0.0000000000000001)},
+ {H5_DOUBLE(0.0000000000000001), H5_DOUBLE(0.0000000000000000)},
+ {H5_DOUBLE(0.00000000000000033), H5_DOUBLE(0.0000000000000001)}};
+ double data14[3][2] ={
+ {H5_DOUBLE(0.0000000000000000), H5_DOUBLE(0.0000000000000004)},
+ {H5_DOUBLE(0.0000000000000002), H5_DOUBLE(0.0000000000000001)},
+ {H5_DOUBLE(0.0000000000000001), H5_DOUBLE(0.00000000000000000)}};
write_dset(gid1,2,dims2,"fp1",H5T_NATIVE_FLOAT,data11);
write_dset(gid1,2,dims2,"fp2",H5T_NATIVE_FLOAT,data12);
@@ -412,7 +418,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
- long double data15[3][2] ={{1,1},{1,1},{1,1}};
+ long double data15[3][2] ={{1.0L,1.0L},{1.0L,1.0L},{1.0L,1.0L}};
write_dset(gid1,2,dims2,"ld",H5T_NATIVE_LDOUBLE,data15);
@@ -430,19 +436,19 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
float data15[6];
float data16[6];
- data15[0] = (float) sqrt( (double)-1 );
- data15[1] = 1;
- data15[2] = (float) sqrt( (double)-1 );
- data15[3] = 1;
- data15[4] = 1;
- data15[5] = 1;
+ data15[0] = (float)HDsqrt(-1.0F);
+ data15[1] = 1.0F;
+ data15[2] = (float)HDsqrt(-1.0F);
+ data15[3] = 1.0F;
+ data15[4] = 1.0F;
+ data15[5] = 1.0F;
- data16[0] = (float) sqrt( (double)-1 );
- data16[1] = (float) sqrt( (double)-1 );
- data16[2] = 1;
- data16[3] = 1;
- data16[4] = 1;
- data16[5] = 1;
+ data16[0] = (float)HDsqrt(-1.0F);
+ data16[1] = (float)HDsqrt(-1.0F);
+ data16[2] = 1.0F;
+ data16[3] = 1.0F;
+ data16[4] = 1.0F;
+ data16[5] = 1.0F;
write_dset(gid1,1,dims1,"fp15",H5T_NATIVE_FLOAT,data15);
write_dset(gid1,1,dims1,"fp16",H5T_NATIVE_FLOAT,data16);
@@ -458,19 +464,19 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
double data17[6];
double data18[6];
- data17[0] = sqrt( (double)-1 );
- data17[1] = 1;
- data17[2] = sqrt( (double)-1 );
- data17[3] = 1;
- data17[4] = 1;
- data17[5] = 1;
+ data17[0] = HDsqrt(-1.0F);
+ data17[1] = 1.0F;
+ data17[2] = HDsqrt(-1.0F);
+ data17[3] = 1.0F;
+ data17[4] = 1.0F;
+ data17[5] = 1.0F;
- data18[0] = (float) sqrt( (double)-1 );
- data18[1] = (float) sqrt( (double)-10000 );
- data18[2] = 1;
- data18[3] = 1;
- data18[4] = 1;
- data18[5] = 1;
+ data18[0] = HDsqrt(-1.0F);
+ data18[1] = HDsqrt(-10000.0F);
+ data18[2] = 1.0F;
+ data18[3] = 1.0F;
+ data18[4] = 1.0F;
+ data18[5] = 1.0F;
write_dset(gid1,1,dims1,"fp17",H5T_NATIVE_DOUBLE,data17);
write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18);
@@ -485,11 +491,11 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
float data19[6];
double data20[6];
- data19[0] = data19[1] = data19[2] = log(0);
- data19[3] = data19[4] = data19[5] = -log(0);
+ data19[0] = data19[1] = data19[2] = (float)HDlog(0.0F);
+ data19[3] = data19[4] = data19[5] = (float)-HDlog(0.0F);
- data20[0] = data20[1] = data20[2] = log(0);
- data20[3] = data20[4] = data20[5] = -log(0);
+ data20[0] = data20[1] = data20[2] = HDlog(0.0F);
+ data20[3] = data20[4] = data20[5] = -HDlog(0.0F);
write_dset(gid1,1,dims1,"fp19",H5T_NATIVE_FLOAT,data19);
write_dset(gid1,1,dims1,"fp19_COPY",H5T_NATIVE_FLOAT,data19);
@@ -514,15 +520,15 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
size_t type_size;
hid_t tid;
- buf1[0].d = sqrt( (double)-1 );
- buf1[0].f = (float) sqrt( (double)-1 );
- buf2[0].d = sqrt( (double)-1 );
- buf2[0].f = (float) sqrt( (double)-1 );
+ buf1[0].d = HDsqrt(-1.0F);
+ buf1[0].f = (float)HDsqrt(-1.0F);
+ buf2[0].d = HDsqrt(-1.0F);
+ buf2[0].f = (float)HDsqrt(-1.0F);
- buf1[1].d = sqrt( (double)-1 );
- buf1[1].f = (float) sqrt( (double)-1 );
- buf2[1].d = 0;
- buf2[1].f = 0;
+ buf1[1].d = HDsqrt(-1.0F);
+ buf1[1].f = (float)HDsqrt(-1.0F);
+ buf2[1].d = 0.0F;
+ buf2[1].f = 0.0F;
type_size = sizeof( cmp1_t );
tid = H5Tcreate (H5T_COMPOUND, type_size );
@@ -555,7 +561,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
int i;
} cmp3_t;
- double data2[6] = {0,0,0,0,0,0};
+ double data2[6] = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
int data3[6] = {0,0,0,0,0,0};
int data4[3][2] = {{0,0},{0,0},{0,0}};
int data5[2][2] = {{0,0},{0,0}};
@@ -770,10 +776,10 @@ int test_datatypes(const char *fname)
int buf3b[3][2] = {{1,1},{3,4},{5,6}};
long buf4a[3][2] = {{1,1},{1,1},{1,1}};
long buf4b[3][2] = {{1,1},{3,4},{5,6}};
- float buf5a[3][2] = {{1,1},{1,1},{1,1}};
- float buf5b[3][2] = {{1,1},{3,4},{5,6}};
- double buf6a[3][2] = {{1,1},{1,1},{1,1}};
- double buf6b[3][2] = {{1,1},{3,4},{5,6}};
+ float buf5a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}};
+ float buf5b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}};
+ double buf6a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}};
+ double buf6b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}};
/*unsigned/signed test
signed char -128 to 127
@@ -1025,10 +1031,10 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
/* file1 attr */
int f1_attr_idata[2]= {1,2}; /* integer */
- float f1_attr_fdata[2]= {1.1,2.2}; /* float */
+ float f1_attr_fdata[2]= {1.1F,2.2F}; /* float */
/* file2 attr */
int f2_attr_idata[2]= {2,3}; /* integer */
- float f2_attr_fdata[2]= {2.1,3.2}; /* float */
+ float f2_attr_fdata[2]= {2.1F,3.2F}; /* float */
/*----------------------------------------------------------------------
@@ -4363,7 +4369,7 @@ static void test_comps_array (const char *fname, const char *dset, const char *a
for(j=0; j < SDIM_CMPD_ARRAY; j++)
{
wdata[i].cmpd2[j].i2 = i*10 + diff;
- wdata[i].cmpd2[j].f2 = (float)(i*10.5) + diff;
+ wdata[i].cmpd2[j].f2 = (float)(i*10.5F) + diff;
} /* end for */
}
@@ -4480,7 +4486,7 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a
for(j=0; j<(i+1); j++)
{
((cmpd2_t *)wdata[i].vl.p)[j].i2 = i*10 + diff;
- ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)(i*10.5) + diff;
+ ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)(i*10.5F) + diff;
} /* end for */
} /* end for */
@@ -4606,7 +4612,7 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch
{
/* Initialize data of compound3 */
((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].i3 = j*10 + diff;
- ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)(j*10.5) + diff;
+ ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)(j*10.5F) + diff;
} /* end for */
} /* end for */
}
@@ -4753,8 +4759,8 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch
for (k=0; k < SDIM_CMPD_ARRAY; k++)
{
/* compound 3 data */
- ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = k*10.5 + diff;
- ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)(k*10.5) + diff;
+ ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = k*10.5F + diff;
+ ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)(k*10.5F) + diff;
}
} /* end for */
} /* end for */
@@ -5246,27 +5252,27 @@ void write_attr_in(hid_t loc_id,
char buf1[2][STR_SIZE]= {"ab","de"}; /* string */
char *buf1a[2]; /* VL string */
char buf2[2]= {1,2}; /* bitfield, opaque */
- s_t buf3[2]= {{1,2},{3,4}}; /* compound */
+ s_t buf3[2]= {{1,2.0F},{3,4.0F}}; /* compound */
hobj_ref_t buf4[2]; /* reference */
e_t buf45[2]= {RED,RED}; /* enum */
hvl_t buf5[2]; /* vlen */
hsize_t dimarray[1]={3}; /* array dimension */
int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
int buf7[2]= {1,2}; /* integer */
- float buf8[2]= {1,2}; /* float */
+ float buf8[2]= {1.0F, 2.0F}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
hsize_t dims2[2]={3,2};
- char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */
- char *buf12a[3][2]; /* VL string */
- char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
- s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
- hobj_ref_t buf42[3][2]; /* reference */
- e_t buf452[3][2]; /* enum */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
- int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
- float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+ char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */
+ char *buf12a[3][2]; /* VL string */
+ char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
+ s_t buf32[6]= {{1,2.0F},{3,4.0F},{5,6.0F},{7,8.0F},{9,10.0F},{11,12.0F}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ e_t buf452[3][2]; /* enum */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
+ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
+ float buf82[3][2]= {{1.0F,2.0F},{3.0F,4.0F},{5.0F,6.0F}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
hsize_t dims3[3]={4,3,2};
@@ -6017,7 +6023,7 @@ void write_attr_in(hid_t loc_id,
for (k = 0; k < 2; k++) {
if (make_diffs) {
buf33[i][j][k].a=0;
- buf33[i][j][k].b=0;
+ buf33[i][j][k].b=0.0F;
}
else {
buf33[i][j][k].a=n++;
@@ -6231,7 +6237,7 @@ void write_attr_in(hid_t loc_id,
for (k = 0; k < 2; k++) {
if (make_diffs) {
buf73[i][j][k]=0;
- buf83[i][j][k]=0;
+ buf83[i][j][k]=0.0F;
}
else {
buf73[i][j][k]=n++;
@@ -6303,26 +6309,26 @@ void write_dset_in(hid_t loc_id,
char buf1[2][STR_SIZE]= {"ab","de"}; /* string */
char *buf1a[2]; /* VL string */
char buf2[2]= {1,2}; /* bitfield, opaque */
- s_t buf3[2]= {{1,2},{3,4}}; /* compound */
+ s_t buf3[2]= {{1,2.0F},{3,4.0F}}; /* compound */
hobj_ref_t buf4[2]; /* reference */
e_t buf45[2]= {RED,GREEN}; /* enum */
hvl_t buf5[2]; /* vlen */
hsize_t dimarray[1]={3}; /* array dimension */
int buf6[2][3]= {{1,2,3},{4,5,6}}; /* array */
int buf7[2]= {1,2}; /* integer */
- float buf8[2]= {1,2}; /* float */
+ float buf8[2]= {1.0F,2.0F}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
hsize_t dims2[2]={3,2};
char buf12[3][2][STR_SIZE]= {{"ab","cd"},{"ef","gh"},{"ij","kl"}}; /* string */
char *buf12a[3][2]; /* VL string */
char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */
- s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */
+ s_t buf32[6]= {{1,2.0F},{3,4.0F},{5,6.0F},{7,8.0F},{9,10.0F},{11,12.0F}}; /* compound */
hobj_ref_t buf42[3][2]; /* reference */
hvl_t buf52[3][2]; /* vlen */
int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */
int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */
- float buf82[3][2]= {{1,2},{3,4},{5,6}}; /* float */
+ float buf82[3][2]= {{1.0F,2.0F},{3.0F,4.0F},{5.0F,6.0F}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
hsize_t dims3[3]={4,3,2};
@@ -6859,7 +6865,7 @@ void write_dset_in(hid_t loc_id,
if (make_diffs)
{
buf33[i][j][k].a=0;
- buf33[i][j][k].b=0;
+ buf33[i][j][k].b=0.0F;
}
else {
buf33[i][j][k].a=n++;
@@ -6968,7 +6974,7 @@ void write_dset_in(hid_t loc_id,
for (k = 0; k < 2; k++) {
if (make_diffs) {
buf73[i][j][k]=0;
- buf83[i][j][k]=0;
+ buf83[i][j][k]=0.0F;
}
else {
buf73[i][j][k]=n++;