diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 1999-07-16 18:12:34 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 1999-07-16 18:12:34 (GMT) |
commit | 74665d2a041abc2b49d80da3126114103fc4a557 (patch) | |
tree | 259c341a0e3550e7066aaf8451645c651316430f /test | |
parent | d762ea6a31d69a9ebe00e6ed818ab6415091b629 (diff) | |
download | hdf5-74665d2a041abc2b49d80da3126114103fc4a557.zip hdf5-74665d2a041abc2b49d80da3126114103fc4a557.tar.gz hdf5-74665d2a041abc2b49d80da3126114103fc4a557.tar.bz2 |
[svn-r1495] Corrections and small bugfixes to VL testing.
Diffstat (limited to 'test')
-rw-r--r-- | test/tvltypes.c | 72 |
1 files changed, 52 insertions, 20 deletions
diff --git a/test/tvltypes.c b/test/tvltypes.c index d29a9e9..539ea99 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -111,10 +111,10 @@ test_vltypes_vlen_atomic(void) /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { - wdata[i].p=malloc((i+1)*sizeof(uint32_t)); + wdata[i].p=malloc((i+1)*sizeof(unsigned int)); wdata[i].len=i+1; for(j=0; j<(i+1); j++) - ((uint32_t *)wdata[i].p)[j]=i*10+j; + ((unsigned int *)wdata[i].p)[j]=i*10+j; } /* end for */ /* Create file */ @@ -150,7 +150,7 @@ test_vltypes_vlen_atomic(void) /* Make certain the correct amount of memory has been used */ /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */ - VERIFY(mem_used,10*sizeof(uint32_t),"H5Dread"); + VERIFY(mem_used,10*sizeof(unsigned int),"H5Dread"); /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { @@ -160,21 +160,25 @@ test_vltypes_vlen_atomic(void) continue; } /* end if */ for(j=0; j<rdata[i].len; j++) { - if( ((uint32_t *)wdata[i].p)[j] != ((uint32_t *)rdata[i].p)[j] ) { + if( ((unsigned int *)wdata[i].p)[j] != ((unsigned int *)rdata[i].p)[j] ) { num_errs++; - printf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((uint32_t *)wdata[i].p)[j], (int)i,(int)j, (int)((uint32_t *)rdata[i].p)[j]); + printf("VL data values don't match!, wdata[%d].p[%d]=%d, rdata[%d].p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].p)[j]); continue; } /* end if */ } /* end for */ } /* end for */ - /* Reclaim the VL data */ + /* Reclaim the read VL data */ ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata); CHECK(ret, FAIL, "H5Dvlen_reclaim"); /* Make certain the VL memory has been freed */ VERIFY(mem_used,0,"H5Dvlen_reclaim"); + /* Reclaim the write VL data */ + ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); + /* Close Dataset */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); @@ -187,6 +191,10 @@ test_vltypes_vlen_atomic(void) ret = H5Sclose(sid1); CHECK(ret, FAIL, "H5Sclose"); + /* Close dataset transfer property list */ + ret = H5Pclose(xfer_pid); + CHECK(ret, FAIL, "H5Pclose"); + /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -305,6 +313,10 @@ test_vltypes_vlen_compound(void) /* Make certain the VL memory has been freed */ VERIFY(mem_used,0,"H5Dvlen_reclaim"); + /* Reclaim the write VL data */ + ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); + /* Close Dataset */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); @@ -321,6 +333,10 @@ test_vltypes_vlen_compound(void) ret = H5Sclose(sid1); CHECK(ret, FAIL, "H5Sclose"); + /* Close dataset transfer property list */ + ret = H5Pclose(xfer_pid); + CHECK(ret, FAIL, "H5Pclose"); + /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -360,10 +376,10 @@ test_vltypes_compound_vlen_atomic(void) for(i=0; i<SPACE1_DIM1; i++) { wdata[i].i=i*10; wdata[i].f=(i*20)/3.0; - wdata[i].v.p=malloc((i+1)*sizeof(uint32_t)); + wdata[i].v.p=malloc((i+1)*sizeof(unsigned int)); wdata[i].v.len=i+1; for(j=0; j<(i+1); j++) - ((uint32_t *)wdata[i].v.p)[j]=i*10+j; + ((unsigned int *)wdata[i].v.p)[j]=i*10+j; } /* end for */ /* Create file */ @@ -411,7 +427,7 @@ test_vltypes_compound_vlen_atomic(void) /* Make certain the correct amount of memory has been used */ /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */ - VERIFY(mem_used,10*sizeof(uint32_t),"H5Dread"); + VERIFY(mem_used,10*sizeof(unsigned int),"H5Dread"); /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { @@ -431,9 +447,9 @@ test_vltypes_compound_vlen_atomic(void) continue; } /* end if */ for(j=0; j<rdata[i].v.len; j++) { - if( ((uint32_t *)wdata[i].v.p)[j] != ((uint32_t *)rdata[i].v.p)[j] ) { + if( ((unsigned int *)wdata[i].v.p)[j] != ((unsigned int *)rdata[i].v.p)[j] ) { num_errs++; - printf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((uint32_t *)wdata[i].v.p)[j], (int)i,(int)j, (int)((uint32_t *)rdata[i].v.p)[j]); + printf("VL data values don't match!, wdata[%d].v.p[%d]=%d, rdata[%d].v.p[%d]=%d\n",(int)i,(int)j, (int)((unsigned int *)wdata[i].v.p)[j], (int)i,(int)j, (int)((unsigned int *)rdata[i].v.p)[j]); continue; } /* end if */ } /* end for */ @@ -446,6 +462,10 @@ test_vltypes_compound_vlen_atomic(void) /* Make certain the VL memory has been freed */ VERIFY(mem_used,0,"H5Dvlen_reclaim"); + /* Reclaim the write VL data */ + ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); + /* Close Dataset */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); @@ -462,6 +482,10 @@ test_vltypes_compound_vlen_atomic(void) ret = H5Sclose(sid1); CHECK(ret, FAIL, "H5Sclose"); + /* Close dataset transfer property list */ + ret = H5Pclose(xfer_pid); + CHECK(ret, FAIL, "H5Pclose"); + /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -498,10 +522,10 @@ test_vltypes_vlen_vlen_atomic(void) wdata[i].p=malloc((i+1)*sizeof(hvl_t)); wdata[i].len=i+1; for(t1=wdata[i].p,j=0; j<(i+1); j++, t1++) { - t1->p=malloc((j+1)*sizeof(uint32_t)); + t1->p=malloc((j+1)*sizeof(unsigned int)); t1->len=j+1; for(k=0; k<(j+1); k++) - ((uint32_t *)t1->p)[k]=i*100+j*10+k; + ((unsigned int *)t1->p)[k]=i*100+j*10+k; } /* end for */ } /* end for */ @@ -542,8 +566,8 @@ test_vltypes_vlen_vlen_atomic(void) /* Make certain the correct amount of memory has been used */ /* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */ - /* 20 uint32_t elements allocated = 1 + 3 + 6 + 10 elements */ - VERIFY(mem_used,10*sizeof(hvl_t)+20*sizeof(uint32_t),"H5Dread"); + /* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */ + VERIFY(mem_used,10*sizeof(hvl_t)+20*sizeof(unsigned int),"H5Dread"); /* Compare data read in */ for(i=0; i<SPACE1_DIM1; i++) { @@ -559,9 +583,9 @@ test_vltypes_vlen_vlen_atomic(void) continue; } /* end if */ for(k=0; k<t2->len; k++) { - if( ((uint32_t *)t1->p)[k] != ((uint32_t *)t2->p)[k] ) { + if( ((unsigned int *)t1->p)[k] != ((unsigned int *)t2->p)[k] ) { num_errs++; - printf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((uint32_t *)t1->p)[k], (int)k, (int)((uint32_t *)t2->p)[k]); + printf("VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)k, (int)((unsigned int *)t1->p)[k], (int)k, (int)((unsigned int *)t2->p)[k]); continue; } /* end if */ } /* end for */ @@ -575,6 +599,10 @@ test_vltypes_vlen_vlen_atomic(void) /* Make certain the VL memory has been freed */ VERIFY(mem_used,0,"H5Dvlen_reclaim"); + /* Reclaim the write VL data */ + ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); + /* Close Dataset */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); @@ -591,6 +619,10 @@ test_vltypes_vlen_vlen_atomic(void) ret = H5Sclose(sid1); CHECK(ret, FAIL, "H5Sclose"); + /* Close dataset transfer property list */ + ret = H5Pclose(xfer_pid); + CHECK(ret, FAIL, "H5Pclose"); + /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -610,9 +642,9 @@ test_vltypes(void) /* These next tests use the same file */ test_vltypes_vlen_atomic(); /* Test VL atomic datatypes */ - test_vltypes_compound_vlen_atomic(); /* Test compound datatypes with VL atomic components */ - test_vltypes_vlen_vlen_atomic(); /* Test VL datatype with VL atomic components */ - test_vltypes_vlen_compound(); /* Test VL compound datatypes */ + test_vltypes_vlen_compound(); /* Test VL compound datatypes */ + test_vltypes_compound_vlen_atomic(); /* Test compound datatypes with VL atomic components */ + test_vltypes_vlen_vlen_atomic(); /* Test VL datatype with VL atomic components */ } /* test_vltypes() */ |