summaryrefslogtreecommitdiffstats
path: root/test/tvlstr.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-01-10 01:41:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-01-10 01:41:13 (GMT)
commit987f5d5e4de41c02b682464fa8e94252553ed57c (patch)
tree2bf74eb88dee718490af7b7dda0e585b0d1b8a95 /test/tvlstr.c
parent12dca9ab3c362fc190feb330232bec4bd552df3c (diff)
downloadhdf5-987f5d5e4de41c02b682464fa8e94252553ed57c.zip
hdf5-987f5d5e4de41c02b682464fa8e94252553ed57c.tar.gz
hdf5-987f5d5e4de41c02b682464fa8e94252553ed57c.tar.bz2
[svn-r8048] 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/tvlstr.c')
-rw-r--r--test/tvlstr.c85
1 files changed, 30 insertions, 55 deletions
diff --git a/test/tvlstr.c b/test/tvlstr.c
index ef35267..2031865 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -12,8 +12,6 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
/***********************************************************
*
* Test program: tvlstr
@@ -191,7 +189,7 @@ test_vlstrings_basic(void)
/* Count the actual number of bytes used by the strings */
for(i=0,str_used=0; i<SPACE1_DIM1; i++)
- str_used+=strlen(wdata[i])+1;
+ str_used+=HDstrlen(wdata[i])+1;
/* Compare against the strings actually written */
VERIFY(size,(hsize_t)str_used,"H5Dvlen_get_buf_size");
@@ -205,14 +203,12 @@ test_vlstrings_basic(void)
/* Compare data read in */
for(i=0; i<SPACE1_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]));
+ if(HDstrlen(wdata[i])!=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]);
+ if( HDstrcmp(wdata[i],rdata[i]) != 0 ) {
+ 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 */
@@ -295,12 +291,9 @@ test_vlstrings_special(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(rdata[i]!=NULL) {
- num_errs++;
- printf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
- } /* end if */
- } /* end for */
+ for(i=0; i<SPACE1_DIM1; i++)
+ if(rdata[i]!=NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
/* Write dataset to disk */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata);
@@ -312,14 +305,12 @@ test_vlstrings_special(void)
/* Compare data read in */
for(i=0; i<SPACE1_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]));
+ if(HDstrlen(wdata[i])!=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]);
+ if( HDstrcmp(wdata[i],rdata[i]) != 0 ) {
+ 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 */
@@ -353,12 +344,9 @@ test_vlstrings_special(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(rdata[i]!=NULL) {
- num_errs++;
- printf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
- } /* end if */
- } /* end for */
+ for(i=0; i<SPACE1_DIM1; i++)
+ if(rdata[i]!=NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
/* Try to write nil strings to disk. */
ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata2);
@@ -369,12 +357,9 @@ test_vlstrings_special(void)
CHECK(ret, FAIL, "H5Dread");
/* Check data read in */
- for(i=0; i<SPACE1_DIM1; i++) {
- if(rdata[i]!=NULL) {
- num_errs++;
- printf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
- } /* end if */
- } /* end for */
+ for(i=0; i<SPACE1_DIM1; i++)
+ if(rdata[i]!=NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -537,14 +522,12 @@ test_compact_vlstring(void)
/* Compare data read in */
for(i=0; i<SPACE1_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]));
+ if(HDstrlen(wdata[i])!=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]);
+ if( HDstrcmp(wdata[i],rdata[i]) != 0 ) {
+ 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 */
@@ -614,10 +597,8 @@ static void test_write_vl_string_attribute(void)
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att)!=0) {
- num_errs++;
- printf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
- } /* end if */
+ if(HDstrcmp(string_att_check,string_att)!=0)
+ TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
HDfree(string_att_check);
@@ -637,10 +618,8 @@ static void test_write_vl_string_attribute(void)
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att_write)!=0) {
- num_errs++;
- printf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
- } /* end if */
+ if(HDstrcmp(string_att_check,string_att_write)!=0)
+ TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
HDfree(string_att_check);
/* The attribute string written is freed below, in the test_read_vl_string_attribute() test */
@@ -698,10 +677,8 @@ static void test_read_vl_string_attribute(void)
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att)!=0) {
- num_errs++;
- printf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
- } /* end if */
+ if(HDstrcmp(string_att_check,string_att)!=0)
+ TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
HDfree(string_att_check);
@@ -715,10 +692,8 @@ static void test_read_vl_string_attribute(void)
ret = H5Aread(att, type, &string_att_check);
CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att_write)!=0) {
- num_errs++;
- printf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
- } /* end if */
+ if(HDstrcmp(string_att_check,string_att_write)!=0)
+ TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
HDfree(string_att_check);
HDfree(string_att_write); /* Free string allocated in test_write_vl_string_attribute */