summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1999-08-19 18:50:30 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1999-08-19 18:50:30 (GMT)
commitae45f73e6a7b4d275628abc2b85fca3f276ea007 (patch)
tree5aa33786ead8c794d2be2f8a41d0026173f7a6c6 /test
parent2468fb8bafb28aaaf05ece5bf65e98f9ec7d5e3e (diff)
downloadhdf5-ae45f73e6a7b4d275628abc2b85fca3f276ea007.zip
hdf5-ae45f73e6a7b4d275628abc2b85fca3f276ea007.tar.gz
hdf5-ae45f73e6a7b4d275628abc2b85fca3f276ea007.tar.bz2
[svn-r1577] Added test for H5Dvlen_get_buf_size function.
Diffstat (limited to 'test')
-rw-r--r--test/tvltypes.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/tvltypes.c b/test/tvltypes.c
index 5e6441c..30d9608 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -116,6 +116,7 @@ test_vltypes_vlen_atomic(void)
hid_t tid1; /* Datatype ID */
hid_t xfer_pid; /* Dataset transfer property list ID */
hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
uintn i,j; /* counting variables */
int mem_used=0; /* Memory used during allocation */
herr_t ret; /* Generic return value */
@@ -158,6 +159,13 @@ test_vltypes_vlen_atomic(void)
ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
+ /* Make certain the correct amount of memory will be used */
+ ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size);
+ CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
+
+ /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
+ VERIFY(size,10*sizeof(unsigned int),"H5Dvlen_get_buf_size");
+
/* Read dataset from disk */
ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata);
CHECK(ret, FAIL, "H5Dread");
@@ -236,6 +244,7 @@ test_vltypes_vlen_compound(void)
hid_t tid1, tid2; /* Datatype IDs */
hid_t xfer_pid; /* Dataset transfer property list ID */
hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
uintn i,j; /* counting variables */
int mem_used=0; /* Memory used during allocation */
herr_t ret; /* Generic return value */
@@ -290,6 +299,13 @@ test_vltypes_vlen_compound(void)
ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
+ /* Make certain the correct amount of memory will be used */
+ ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size);
+ CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
+
+ /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
+ VERIFY(size,10*sizeof(s1),"H5Dvlen_get_buf_size");
+
/* Read dataset from disk */
ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata);
CHECK(ret, FAIL, "H5Dread");
@@ -378,6 +394,7 @@ test_vltypes_compound_vlen_atomic(void)
hid_t tid1, tid2; /* Datatype IDs */
hid_t xfer_pid; /* Dataset transfer property list ID */
hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
uintn i,j; /* counting variables */
int mem_used=0; /* Memory used during allocation */
herr_t ret; /* Generic return value */
@@ -434,6 +451,13 @@ test_vltypes_compound_vlen_atomic(void)
ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
+ /* Make certain the correct amount of memory will be used */
+ ret=H5Dvlen_get_buf_size(dataset,tid2,sid1,&size);
+ CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
+
+ /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
+ VERIFY(size,10*sizeof(unsigned int),"H5Dvlen_get_buf_size");
+
/* Read dataset from disk */
ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata);
CHECK(ret, FAIL, "H5Dread");
@@ -523,6 +547,7 @@ test_vltypes_vlen_vlen_atomic(void)
hid_t tid1, tid2; /* Datatype IDs */
hid_t xfer_pid; /* Dataset transfer property list ID */
hsize_t dims1[] = {SPACE1_DIM1};
+ hsize_t size; /* Number of bytes which will be used */
uintn i,j,k; /* counting variables */
int mem_used=0; /* Memory used during allocation */
herr_t ret; /* Generic return value */
@@ -573,6 +598,14 @@ test_vltypes_vlen_vlen_atomic(void)
ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
CHECK(ret, FAIL, "H5Pset_vlen_mem_manager");
+ /* Make certain the correct amount of memory will be used */
+ ret=H5Dvlen_get_buf_size(dataset,tid2,sid1,&size);
+ CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
+
+ /* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
+ /* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
+ VERIFY(size,10*sizeof(hvl_t)+20*sizeof(unsigned int),"H5Dvlen_get_buf_size");
+
/* Read dataset from disk */
ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata);
CHECK(ret, FAIL, "H5Dread");