summaryrefslogtreecommitdiffstats
path: root/test/tmisc.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-01-10 01:41:34 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-01-10 01:41:34 (GMT)
commit7f6fbe6b604423782f6195b809a23c32d0bd1863 (patch)
treee8c77f2aec3dbc365983995305864e47c5119b18 /test/tmisc.c
parentc891e4a01e575cec23d51b526fd792b57eab9d06 (diff)
downloadhdf5-7f6fbe6b604423782f6195b809a23c32d0bd1863.zip
hdf5-7f6fbe6b604423782f6195b809a23c32d0bd1863.tar.gz
hdf5-7f6fbe6b604423782f6195b809a23c32d0bd1863.tar.bz2
[svn-r8049] Purpose:
Code cleanup & reorganization Description: Move further in the testing framework cleanup, eliminating all the global variables (moving them into testframe.c as static variables) from the testing framework code and moving it into the libh5test.a. Platforms tested: FreeBSD 4.9 (sleipnir) w & w/o thread-safety, c++ & parallel h5committested
Diffstat (limited to 'test/tmisc.c')
-rw-r--r--test/tmisc.c87
1 files changed, 29 insertions, 58 deletions
diff --git a/test/tmisc.c b/test/tmisc.c
index 8886420..05a5ccd 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -573,12 +573,10 @@ test_misc4(void)
/* Verify that the fileno values are not the same between file1 & file2 */
if(stat1.fileno[0]==stat3.fileno[0] && stat1.fileno[1]==stat3.fileno[1]) {
- num_errs++;
- printf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__);
+ TestErrPrintf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__);
} /* end if */
if(stat2.fileno[0]==stat3.fileno[0] && stat2.fileno[1]==stat3.fileno[1]) {
- num_errs++;
- printf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__);
+ TestErrPrintf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__);
} /* end if */
/* Close the objects */
@@ -1407,8 +1405,7 @@ test_misc8(void)
for(u=0; u<MISC8_DIM0; u++)
for(v=0; v<MISC8_DIM1; v++,tdata++,tdata2++)
if(*tdata!=*tdata2) {
- num_errs++;
- printf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2);
+ TestErrPrintf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2);
}
#endif /* VERIFY_DATA */
@@ -1445,13 +1442,11 @@ test_misc8(void)
CHECK(storage_size, 0, "H5Dget_storage_size");
#ifdef H5_HAVE_FILTER_DEFLATE
if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
- num_errs++;
- printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
}
#else /* Compression is not configured */
if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
- num_errs++;
- printf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
}
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -1481,13 +1476,11 @@ test_misc8(void)
CHECK(storage_size, 0, "H5Dget_storage_size");
#ifdef H5_HAVE_FILTER_DEFLATE
if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
- num_errs++;
- printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
}
#else /* Compression is not configured */
if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
- num_errs++;
- printf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
}
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -1506,8 +1499,7 @@ test_misc8(void)
for(u=0; u<MISC8_DIM0; u++)
for(v=0; v<MISC8_DIM1; v++,tdata++,tdata2++)
if(*tdata!=*tdata2) {
- num_errs++;
- printf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2);
+ TestErrPrintf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2);
}
#endif /* VERIFY_DATA */
@@ -1516,13 +1508,11 @@ test_misc8(void)
CHECK(storage_size, 0, "H5Dget_storage_size");
#ifdef H5_HAVE_FILTER_DEFLATE
if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
- num_errs++;
- printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
}
#else
if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
- num_errs++;
- printf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
}
#endif /*H5_HAVE_FILTER_DEFLATE*/
@@ -1551,13 +1541,11 @@ test_misc8(void)
CHECK(storage_size, 0, "H5Dget_storage_size");
#ifdef H5_HAVE_FILTER_DEFLATE
if(storage_size>=(4*MISC8_CHUNK_DIM0*MISC8_CHUNK_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
- num_errs++;
- printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
}
#else /* Compression is not configured */
if(storage_size!=(4*MISC8_CHUNK_DIM0*MISC8_CHUNK_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
- num_errs++;
- printf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
}
#endif /* H5_HAVE_FILTER_DEFLATE */
@@ -1576,8 +1564,7 @@ test_misc8(void)
for(u=0; u<MISC8_DIM0; u++)
for(v=0; v<MISC8_DIM1; v++,tdata++,tdata2++)
if(*tdata!=*tdata2) {
- num_errs++;
- printf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2);
+ TestErrPrintf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2);
}
#endif /* VERIFY_DATA */
@@ -1586,13 +1573,11 @@ test_misc8(void)
CHECK(storage_size, 0, "H5Dget_storage_size");
#ifdef H5_HAVE_FILTER_DEFLATE
if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
- num_errs++;
- printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ TestErrPrintf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
}
#else
if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
- num_errs++;
- printf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ TestErrPrintf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
}
#endif /*H5_HAVE_FILTER_DEFLATE*/
@@ -1976,13 +1961,11 @@ test_misc12(void)
for(i=0; i<MISC12_SPACE1_DIM1; i++)
if(HDstrcmp(wdata[i],rdata[i])) {
- num_errs++;
- printf("Error on line %d: wdata[%d]=%s, rdata[%d]=%s\n",__LINE__,i,wdata[i],i,rdata[i]);
+ TestErrPrintf("Error on line %d: wdata[%d]=%s, rdata[%d]=%s\n",__LINE__,i,wdata[i],i,rdata[i]);
} /* end if */
for(; i<(MISC12_SPACE1_DIM1+MISC12_APPEND_SIZE); i++)
if(HDstrcmp(wdata1[i-MISC12_SPACE1_DIM1],rdata[i])) {
- num_errs++;
- printf("Error on line %d: wdata1[%d]=%s, rdata[%d]=%s\n",__LINE__,i-MISC12_SPACE1_DIM1,wdata1[i-MISC12_SPACE1_DIM1],i,rdata[i]);
+ TestErrPrintf("Error on line %d: wdata1[%d]=%s, rdata[%d]=%s\n",__LINE__,i-MISC12_SPACE1_DIM1,wdata1[i-MISC12_SPACE1_DIM1],i,rdata[i]);
} /* end if */
/* Reclaim VL data memory */
@@ -2422,8 +2405,7 @@ test_misc14(void)
ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
if(rdata!=data1) {
- num_errs++;
- printf("Error on line %d: data1!=rdata\n",__LINE__);
+ TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__);
} /* end if */
/* Unlink second dataset */
@@ -2438,8 +2420,7 @@ test_misc14(void)
ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
if(rdata!=data1) {
- num_errs++;
- printf("Error on line %d: data1!=rdata\n",__LINE__);
+ TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__);
} /* end if */
/* Close first dataset */
@@ -2474,8 +2455,7 @@ test_misc14(void)
ret = H5Dread(Dataset2, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
if(rdata!=data2) {
- num_errs++;
- printf("Error on line %d: data2!=rdata\n",__LINE__);
+ TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__);
} /* end if */
/* Unlink first dataset */
@@ -2490,8 +2470,7 @@ test_misc14(void)
ret = H5Dread(Dataset2, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
if(rdata!=data2) {
- num_errs++;
- printf("Error on line %d: data2!=rdata\n",__LINE__);
+ TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__);
} /* end if */
/* Close second dataset */
@@ -2533,16 +2512,14 @@ test_misc14(void)
ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
if(rdata!=data1) {
- num_errs++;
- printf("Error on line %d: data1!=rdata\n",__LINE__);
+ TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__);
} /* end if */
/* Check data from third dataset */
ret = H5Dread(Dataset3, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
if(rdata!=data3) {
- num_errs++;
- printf("Error on line %d: data3!=rdata\n",__LINE__);
+ TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__);
} /* end if */
/* Unlink second dataset */
@@ -2557,16 +2534,14 @@ test_misc14(void)
ret = H5Dread(Dataset1, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
if(rdata!=data1) {
- num_errs++;
- printf("Error on line %d: data1!=rdata\n",__LINE__);
+ TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__);
} /* end if */
/* Verify the data from dataset #3 */
ret = H5Dread(Dataset3, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata);
CHECK(ret, FAIL, "H5Dread");
if(rdata!=data3) {
- num_errs++;
- printf("Error on line %d: data3!=rdata\n",__LINE__);
+ TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__);
} /* end if */
/* Close first dataset */
@@ -2694,13 +2669,11 @@ test_misc16(void)
/* Compare data read in */
for(i=0; i<MISC16_SPACE_DIM; i++) {
if(strlen(wdata[i])!=strlen(rdata[i])) {
- num_errs++;
- printf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
+ TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
continue;
} /* end if */
if( strcmp(wdata[i],rdata[i]) != 0 ) {
- num_errs++;
- printf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
continue;
} /* end if */
} /* end for */
@@ -2772,13 +2745,11 @@ test_misc17(void)
/* Compare data in the way of strings. */
for(i=0; i<MISC17_SPACE_DIM1; i++) {
if(strlen(wdata[i])!=strlen(rdata[i])) {
- num_errs++;
- printf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
+ TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
continue;
} /* end if */
if( strcmp(wdata[i],rdata[i]) != 0 ) {
- num_errs++;
- printf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
continue;
} /* end if */
} /* end for */