summaryrefslogtreecommitdiffstats
path: root/tools/h5diff/h5diffgentest.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5diff/h5diffgentest.c')
-rw-r--r--tools/h5diff/h5diffgentest.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index e1a554e..7d9add7 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -95,27 +95,27 @@ static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t
*-------------------------------------------------------------------------
*/
-int main(void)
+int main(void)
{
if (test_basic(FILE1, FILE2, FILE11) < 0 )
goto out;
test_types (FILE3);
test_datatypes(FILE4);
-
+
/* generate 2 files, the second call creates a similar file with differences */
test_attributes(FILE5,0);
test_attributes(FILE6,1);
-
+
/* generate 2 files, the second call creates a similar file with differences */
test_datasets(FILE7,0);
test_datasets(FILE8,1);
-
+
/* generate 2 files, the second call creates a similar file with differences */
test_hyperslab(FILE9,0);
test_hyperslab(FILE10,1);
return 0;
-
+
out:
return 1;
}
@@ -146,12 +146,12 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
fprintf(stderr, "empty file (%s) close failed.\n", fname3);
goto out;
}
-
+
/*-------------------------------------------------------------------------
* create two files
*-------------------------------------------------------------------------
*/
-
+
if (( fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 )
goto out;
if (( fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 )
@@ -179,15 +179,15 @@ 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 data3[3][2] = {{100,100},{100,100},{100,100}};
double data4[3][2] = {{105,120},{160,95},{80,40}};
-
+
write_dset(gid1,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data1);
write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_DOUBLE,data2);
write_dset(gid1,2,dims2,"dset3",H5T_NATIVE_DOUBLE,data3);
write_dset(gid2,2,dims2,"dset4",H5T_NATIVE_DOUBLE,data4);
write_dset(gid2,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data2);
-
+
}
/*-------------------------------------------------------------------------
* relative error, compare divide by zero, both zero
@@ -195,12 +195,12 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- int data5[3][2] = {{100,100},{100,0},{0,100}};
+ int data5[3][2] = {{100,100},{100,0},{0,100}};
int data6[3][2] = {{120,80}, {0,100},{0,50}};
-
+
write_dset(gid1,2,dims2,"dset5",H5T_NATIVE_INT,data5);
write_dset(gid1,2,dims2,"dset6",H5T_NATIVE_INT,data6);
-
+
}
/*-------------------------------------------------------------------------
@@ -209,12 +209,12 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- unsigned long_long data7[3][2] = {{100,100},{100,0},{0,100}};
+ unsigned long_long data7[3][2] = {{100,100},{100,0},{0,100}};
unsigned long_long data8[3][2] = {{120,80}, {0,100},{0,50}};
-
+
write_dset(gid1,2,dims2,"dset7",H5T_NATIVE_ULLONG,data7);
write_dset(gid1,2,dims2,"dset8",H5T_NATIVE_ULLONG,data8);
-
+
}
/*-------------------------------------------------------------------------
@@ -231,14 +231,14 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- double data9[3][2] = {{100,100},{100,0},{0,100}};
+ double data9[3][2] = {{100,100},{100,0},{0,100}};
double data10[3][2] ={{120,80}, {0,100},{0,50}};
-
+
write_dset(gid1,2,dims2,"dset9",H5T_NATIVE_DOUBLE,data9);
write_dset(gid1,2,dims2,"dset10",H5T_NATIVE_DOUBLE,data10);
-
+
}
-
+
/*-------------------------------------------------------------------------
* test floating point comparison
@@ -250,15 +250,15 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
float data12[3][2] ={{0.00000f,0.00002f},{0.000009f,0.00001f},{0.00000f,0.00001f}};
double data13[3][2] ={{0.000000000,0.000000001},{0.000000001, 0.000000000},{0.000000001,0.000000001}};
double data14[3][2] ={{0.000000000,0.000000002},{0.0000000009,0.000000001},{0.000000000,0.000000001}};
-
+
write_dset(gid1,2,dims2,"fp1",H5T_NATIVE_FLOAT,data11);
write_dset(gid1,2,dims2,"fp2",H5T_NATIVE_FLOAT,data12);
write_dset(gid1,2,dims2,"d1",H5T_NATIVE_DOUBLE,data13);
write_dset(gid1,2,dims2,"d2",H5T_NATIVE_DOUBLE,data14);
-
+
}
-
-
+
+
/*-------------------------------------------------------------------------
* NaNs in H5T_NATIVE_FLOAT
*-------------------------------------------------------------------------
@@ -286,7 +286,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
write_dset(gid1,1,dims1,"fp16",H5T_NATIVE_FLOAT,data16);
}
-
+
/*-------------------------------------------------------------------------
* NaNs in H5T_NATIVE_DOUBLE
*-------------------------------------------------------------------------
@@ -314,8 +314,8 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18);
}
-
-
+
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
@@ -450,7 +450,7 @@ TOOLTEST h5diff_23.txt file3.h5 file3.h5 -v g1 g1
TOOLTEST h5diff_24.txt file3.h5 file3.h5 -v t1 t1
# 2.5
-TOOLTEST h5diff_25.txt file3.h5 file3.h5 -v l1 l1
+TOOLTEST h5diff_25.txt file3.h5 file3.h5 -v l1 l1
# 2.6
TOOLTEST h5diff_26.txt file3.h5 file3.h5 -v g1 g2
@@ -2508,12 +2508,12 @@ void gen_datareg(hid_t fid,
* Function: test_hyperslab
*
* Purpose: test diff by hyperslabs. create a dataset with 1GB dimensions
- * by iterating trough 1KB hyperslabs
+ * by iterating trough 1KB hyperslabs
*
*-------------------------------------------------------------------------
*/
static
-int test_hyperslab(const char *fname,
+int test_hyperslab(const char *fname,
int make_diffs /* flag to modify data buffers */)
{
hid_t did=-1;
@@ -2533,7 +2533,7 @@ int test_hyperslab(const char *fname,
int i, j, s;
char c;
- /* create */
+ /* create */
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
@@ -2545,13 +2545,13 @@ int test_hyperslab(const char *fname,
goto out;
if((did = H5Dcreate2(fid, "big", H5T_NATIVE_CHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
+ if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
goto out;
- if((tid = H5Dget_type(did)) < 0)
+ if((tid = H5Dget_type(did)) < 0)
goto out;
if((size = H5Tget_size(tid)) <= 0)
goto out;
-
+
/* create a evenly divided buffer from 0 to 127 */
buf = (char *)HDmalloc((size_t)(nelmts * size));
s = 1024 * 1024 / 127;
@@ -2567,15 +2567,15 @@ int test_hyperslab(const char *fname,
/* make a different hyperslab at this position */
if(make_diffs && i == 512 * 512)
HDmemset(buf, 0, nelmts);
-
+
hs_start[0] = i * GBLL/(1024*1024);
- if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0)
+ if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0)
goto out;
/* write only one hyperslab */
if ( i==512*512)
{
- if (H5Dwrite (did,H5T_NATIVE_CHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0)
+ if (H5Dwrite (did,H5T_NATIVE_CHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0)
goto out;
}
@@ -2626,30 +2626,30 @@ int write_attr(hid_t loc_id,
{
hid_t aid=-1;
hid_t sid=-1;
-
+
/* create a space */
if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
goto out;
-
+
/* create the attribute */
if((aid = H5Acreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
-
+
/* write */
if(buf)
{
if(H5Awrite(aid, tid, buf) < 0)
goto out;
}
-
+
/* close */
H5Aclose(aid);
H5Sclose(sid);
-
+
return SUCCEED;
-
+
out:
-
+
H5Aclose(aid);
H5Sclose(sid);
return FAIL;