summaryrefslogtreecommitdiffstats
path: root/src/H5EAtest.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-08-29 20:44:11 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-08-29 20:44:11 (GMT)
commitc78dc8defa003eb2fe95dcae6fe115443cdcbffc (patch)
treed110b661509005e865690cf40bc10e07466b43b7 /src/H5EAtest.c
parent90e4c8770646a057dfc1efa88a64e219d65f31e0 (diff)
downloadhdf5-c78dc8defa003eb2fe95dcae6fe115443cdcbffc.zip
hdf5-c78dc8defa003eb2fe95dcae6fe115443cdcbffc.tar.gz
hdf5-c78dc8defa003eb2fe95dcae6fe115443cdcbffc.tar.bz2
[svn-r15561] Description:
Update extensible array code with function to open an existing earray, add more tests and avoid running the test when core/split/family/multi VFDs are used. Clean up fractal heap test code a bit and expand some of the tests a little bit also. Tested on: Mac OS X/32 10.5.4 (amazon) in debug mode Mac OS X/32 10.5.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5EAtest.c')
-rw-r--r--src/H5EAtest.c123
1 files changed, 120 insertions, 3 deletions
diff --git a/src/H5EAtest.c b/src/H5EAtest.c
index c05084d..0096d9c 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -60,11 +60,27 @@
/* Local Prototypes */
/********************/
+/* Extensible array class callbacks */
+static herr_t H5EA_test_fill(uint8_t *raw_blk, size_t nelmts);
+static herr_t H5EA_test_encode(uint8_t *raw, const void *elmt);
+static herr_t H5EA_test_decode(const uint8_t *raw, void *elmt);
+static herr_t H5EA_test_debug(FILE *stream, int indent, int fwidth, const void *elmt);
+
/*********************/
/* Package Variables */
/*********************/
+/* Extensible array testing class information */
+const H5EA_class_t H5EA_CLS_TEST[1]={{
+ H5EA_CLS_TEST_ID, /* Type of Extensible array */
+ sizeof(haddr_t), /* Size of native record */
+ H5EA_test_fill, /* Fill block of missing elements callback */
+ H5EA_test_encode, /* Element encoding callback */
+ H5EA_test_decode, /* Element decoding callback */
+ H5EA_test_debug /* Element debugging callback */
+}};
+
/*****************************/
/* Library Private Variables */
@@ -78,6 +94,102 @@
/*-------------------------------------------------------------------------
+ * Function: H5EA_test_fill
+ *
+ * Purpose: Fill "missing elements" in block of elements
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, August 28, 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(STATIC, NOERR,
+herr_t, SUCCEED, -,
+H5EA_test_fill(uint8_t *raw_blk, size_t nelmts))
+
+ /* Sanity checks */
+ HDassert(raw_blk);
+ HDassert(nelmts);
+
+END_FUNC(STATIC) /* end H5EA_test_fill() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5EA_test_encode
+ *
+ * Purpose: Encode an element from "native" to "raw" form
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, August 28, 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(STATIC, NOERR,
+herr_t, SUCCEED, -,
+H5EA_test_encode(uint8_t *raw, const void *elmt))
+
+ /* Sanity checks */
+ HDassert(raw);
+ HDassert(elmt);
+
+END_FUNC(STATIC) /* end H5EA_test_encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5EA_test_decode
+ *
+ * Purpose: Decode an element from "raw" to "native" form
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, August 28, 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(STATIC, NOERR,
+herr_t, SUCCEED, -,
+H5EA_test_decode(const uint8_t *raw, void *elmt))
+
+ /* Sanity checks */
+ HDassert(raw);
+ HDassert(elmt);
+
+END_FUNC(STATIC) /* end H5EA_test_decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5EA_test_debug
+ *
+ * Purpose: Display an element for debugging
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, August 28, 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(STATIC, NOERR,
+herr_t, SUCCEED, -,
+H5EA_test_debug(FILE *stream, int indent, int fwidth, const void *elmt))
+
+ /* Sanity checks */
+ HDassert(stream);
+ HDassert(elmt);
+
+END_FUNC(STATIC) /* end H5EA_test_debug() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5EA_get_cparam_test
*
* Purpose: Retrieve the parameters used to create the extensible array
@@ -99,7 +211,8 @@ H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam))
HDassert(cparam);
/* Get extensible array creation parameters */
- cparam->elmt_size = ea->hdr->elmt_size;
+ cparam->raw_elmt_size = ea->hdr->raw_elmt_size;
+ cparam->max_nelmts_bits = ea->hdr->max_nelmts_bits;
cparam->idx_blk_elmts = ea->hdr->idx_blk_elmts;
cparam->sup_blk_min_data_ptrs = ea->hdr->sup_blk_min_data_ptrs;
cparam->data_blk_min_elmts = ea->hdr->data_blk_min_elmts;
@@ -129,9 +242,13 @@ H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2)
HDassert(cparam2);
/* Compare creation parameters for array */
- if(cparam1->elmt_size < cparam2->elmt_size)
+ if(cparam1->raw_elmt_size < cparam2->raw_elmt_size)
+ H5_LEAVE(-1)
+ else if(cparam1->raw_elmt_size > cparam2->raw_elmt_size)
+ H5_LEAVE(1)
+ if(cparam1->max_nelmts_bits < cparam2->max_nelmts_bits)
H5_LEAVE(-1)
- else if(cparam1->elmt_size > cparam2->elmt_size)
+ else if(cparam1->max_nelmts_bits > cparam2->max_nelmts_bits)
H5_LEAVE(1)
if(cparam1->idx_blk_elmts < cparam2->idx_blk_elmts)
H5_LEAVE(-1)