summaryrefslogtreecommitdiffstats
path: root/test/tvlstr.c
diff options
context:
space:
mode:
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 */