summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am7
-rw-r--r--test/Makefile.in84
-rw-r--r--test/btree2.c271
3 files changed, 323 insertions, 39 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 289abc9..0a1a243 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -28,11 +28,12 @@ check_SCRIPTS = $(TEST_SCRIPT)
# These are our main targets. They should be listed in the order to be
# executed, generally most specific tests to least specific tests.
-TEST_PROG=testhdf5 lheap ohdr stab gheap cache hyperslab istore bittests \
+TEST_PROG=testhdf5 lheap ohdr stab gheap cache hyperslab istore bittests \
dtypes dsets cmpd_dset extend external links unlink big mtime \
fillval mount flush1 flush2 enum gass_write gass_read gass_append \
set_extent srb_write srb_append srb_read ttsafe stream_test \
- getname file_handle ntypes dangle dtransform filename reserved
+ getname file_handle ntypes dangle dtransform filename reserved \
+ btree2
# List programs to be built when testing here. error_test and err_compat are
# built at the same time as the other tests, but executed by testerror.sh.
@@ -87,7 +88,7 @@ MOSTLYCLEANFILES=cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h5\
family_file000[0-3][0-9].h5 multi_file-[rs].h5 core_file \
new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \
dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \
- unlink_chunked.h5
+ unlink_chunked.h5 btree2.h5
# Sources for testhdf5 executable
testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tconfig.c tfile.c tgenprop.c \
diff --git a/test/Makefile.in b/test/Makefile.in
index 002b068..299cd79 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -208,11 +208,12 @@ check_SCRIPTS = $(TEST_SCRIPT)
# These are our main targets. They should be listed in the order to be
# executed, generally most specific tests to least specific tests.
-TEST_PROG = testhdf5 lheap ohdr stab gheap cache hyperslab istore bittests \
+TEST_PROG = testhdf5 lheap ohdr stab gheap cache hyperslab istore bittests \
dtypes dsets cmpd_dset extend external links unlink big mtime \
fillval mount flush1 flush2 enum gass_write gass_read gass_append \
set_extent srb_write srb_append srb_read ttsafe stream_test \
- getname file_handle ntypes dangle dtransform filename reserved
+ getname file_handle ntypes dangle dtransform filename reserved \
+ btree2
# List programs to be built when testing here. error_test and err_compat are
@@ -258,7 +259,7 @@ MOSTLYCLEANFILES = cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h
family_file000[0-3][0-9].h5 multi_file-[rs].h5 core_file \
new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \
dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \
- unlink_chunked.h5
+ unlink_chunked.h5 btree2.h5
# Sources for testhdf5 executable
@@ -298,7 +299,8 @@ check_PROGRAMS = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \
ttsafe$(EXEEXT) stream_test$(EXEEXT) getname$(EXEEXT) \
file_handle$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \
dtransform$(EXEEXT) filename$(EXEEXT) reserved$(EXEEXT) \
- error_test$(EXEEXT) err_compat$(EXEEXT) testmeta$(EXEEXT)
+ btree2$(EXEEXT) error_test$(EXEEXT) err_compat$(EXEEXT) \
+ testmeta$(EXEEXT)
big_SOURCES = big.c
big_OBJECTS = big.$(OBJEXT)
big_LDADD = $(LDADD)
@@ -309,6 +311,11 @@ bittests_OBJECTS = bittests.$(OBJEXT)
bittests_LDADD = $(LDADD)
bittests_DEPENDENCIES = $(top_builddir)/src/libhdf5.la libh5test.la
bittests_LDFLAGS =
+btree2_SOURCES = btree2.c
+btree2_OBJECTS = btree2.$(OBJEXT)
+btree2_LDADD = $(LDADD)
+btree2_DEPENDENCIES = $(top_builddir)/src/libhdf5.la libh5test.la
+btree2_LDFLAGS =
cache_SOURCES = cache.c
cache_OBJECTS = cache.$(OBJEXT)
cache_LDADD = $(LDADD)
@@ -525,35 +532,36 @@ LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/big.Po ./$(DEPDIR)/bittests.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/cache.Po ./$(DEPDIR)/cmpd_dset.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/dangle.Po ./$(DEPDIR)/dsets.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/dtransform.Po ./$(DEPDIR)/dtypes.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/enum.Po ./$(DEPDIR)/err_compat.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/error_test.Po ./$(DEPDIR)/extend.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/external.Po ./$(DEPDIR)/file_handle.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/filename.Po ./$(DEPDIR)/fillval.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/flush1.Po ./$(DEPDIR)/flush2.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/gass_append.Po ./$(DEPDIR)/gass_read.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/gass_write.Po ./$(DEPDIR)/getname.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/gheap.Po ./$(DEPDIR)/h5test.Plo \
-@AMDEP_TRUE@ ./$(DEPDIR)/hyperslab.Po ./$(DEPDIR)/istore.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/lheap.Po ./$(DEPDIR)/links.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/mount.Po ./$(DEPDIR)/mtime.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/ntypes.Po ./$(DEPDIR)/ohdr.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/reserved.Po ./$(DEPDIR)/set_extent.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/srb_append.Po ./$(DEPDIR)/srb_read.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/srb_write.Po ./$(DEPDIR)/stab.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/stream_test.Po ./$(DEPDIR)/tarray.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/tattr.Po ./$(DEPDIR)/tconfig.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/testframe.Plo ./$(DEPDIR)/testhdf5.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/testmeta.Po ./$(DEPDIR)/tfile.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/tgenprop.Po ./$(DEPDIR)/th5s.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/theap.Po ./$(DEPDIR)/tid.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/titerate.Po ./$(DEPDIR)/tmeta.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/tmisc.Po ./$(DEPDIR)/trefer.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/trefstr.Po ./$(DEPDIR)/tselect.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/tskiplist.Po ./$(DEPDIR)/ttime.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/ttsafe.Po ./$(DEPDIR)/ttsafe_acreate.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/btree2.Po ./$(DEPDIR)/cache.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/cmpd_dset.Po ./$(DEPDIR)/dangle.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/dsets.Po ./$(DEPDIR)/dtransform.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/dtypes.Po ./$(DEPDIR)/enum.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/err_compat.Po ./$(DEPDIR)/error_test.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/extend.Po ./$(DEPDIR)/external.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/file_handle.Po ./$(DEPDIR)/filename.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/fillval.Po ./$(DEPDIR)/flush1.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/flush2.Po ./$(DEPDIR)/gass_append.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/gass_read.Po ./$(DEPDIR)/gass_write.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/getname.Po ./$(DEPDIR)/gheap.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/h5test.Plo ./$(DEPDIR)/hyperslab.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/istore.Po ./$(DEPDIR)/lheap.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/links.Po ./$(DEPDIR)/mount.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/mtime.Po ./$(DEPDIR)/ntypes.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/ohdr.Po ./$(DEPDIR)/reserved.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/set_extent.Po ./$(DEPDIR)/srb_append.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/srb_read.Po ./$(DEPDIR)/srb_write.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/stab.Po ./$(DEPDIR)/stream_test.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tarray.Po ./$(DEPDIR)/tattr.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tconfig.Po ./$(DEPDIR)/testframe.Plo \
+@AMDEP_TRUE@ ./$(DEPDIR)/testhdf5.Po ./$(DEPDIR)/testmeta.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tfile.Po ./$(DEPDIR)/tgenprop.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/th5s.Po ./$(DEPDIR)/theap.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tid.Po ./$(DEPDIR)/titerate.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tmeta.Po ./$(DEPDIR)/tmisc.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/trefer.Po ./$(DEPDIR)/trefstr.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tselect.Po ./$(DEPDIR)/tskiplist.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/ttime.Po ./$(DEPDIR)/ttsafe.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/ttsafe_acreate.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ttsafe_cancel.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ttsafe_dcreate.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ttsafe_error.Po ./$(DEPDIR)/ttst.Po \
@@ -567,7 +575,7 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
-DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c cache.c \
+DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c btree2.c cache.c \
cmpd_dset.c dangle.c dsets.c dtransform.c dtypes.c enum.c \
err_compat.c error_test.c extend.c external.c file_handle.c \
filename.c fillval.c flush1.c flush2.c gass_append.c \
@@ -577,7 +585,7 @@ DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c cache.c \
stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) \
unlink.c
DIST_COMMON = Makefile.am Makefile.in
-SOURCES = $(libh5test_la_SOURCES) big.c bittests.c cache.c cmpd_dset.c dangle.c dsets.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c file_handle.c filename.c fillval.c flush1.c flush2.c gass_append.c gass_read.c gass_write.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c ohdr.c reserved.c set_extent.c srb_append.c srb_read.c srb_write.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c
+SOURCES = $(libh5test_la_SOURCES) big.c bittests.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c file_handle.c filename.c fillval.c flush1.c flush2.c gass_append.c gass_read.c gass_write.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c ohdr.c reserved.c set_extent.c srb_append.c srb_read.c srb_write.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c
all: all-am
@@ -585,7 +593,7 @@ all: all-am
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
- $(AUTOMAKE) --foreign test/Makefile
+ $(AUTOMAKE) --gnu test/Makefile
Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
@@ -612,6 +620,9 @@ big$(EXEEXT): $(big_OBJECTS) $(big_DEPENDENCIES)
bittests$(EXEEXT): $(bittests_OBJECTS) $(bittests_DEPENDENCIES)
@rm -f bittests$(EXEEXT)
$(LINK) $(bittests_LDFLAGS) $(bittests_OBJECTS) $(bittests_LDADD) $(LIBS)
+btree2$(EXEEXT): $(btree2_OBJECTS) $(btree2_DEPENDENCIES)
+ @rm -f btree2$(EXEEXT)
+ $(LINK) $(btree2_LDFLAGS) $(btree2_OBJECTS) $(btree2_LDADD) $(LIBS)
cache$(EXEEXT): $(cache_OBJECTS) $(cache_DEPENDENCIES)
@rm -f cache$(EXEEXT)
$(LINK) $(cache_LDFLAGS) $(cache_OBJECTS) $(cache_LDADD) $(LIBS)
@@ -741,6 +752,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/big.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bittests.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btree2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmpd_dset.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dangle.Po@am__quote@
diff --git a/test/btree2.c b/test/btree2.c
new file mode 100644
index 0000000..182c4fa
--- /dev/null
+++ b/test/btree2.c
@@ -0,0 +1,271 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Tuesday, February 1, 2005
+ */
+#include "h5test.h"
+
+/*
+ * This file needs to access private datatypes from the H5B2 package.
+ */
+#define H5B2_PACKAGE
+#include "H5B2pkg.h"
+
+/* Other private headers that this test requires */
+#include "H5Iprivate.h"
+
+const char *FILENAME[] = {
+ "btree2",
+ NULL
+};
+
+
+/*-------------------------------------------------------------------------
+ * Function: store
+ *
+ * Purpose: Store native information into record for B-tree
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, February 3, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+store(const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *udata, void *nrecord)
+{
+ *(hsize_t *)nrecord=*(const hsize_t *)udata;
+
+#ifdef QAK
+HDfprintf(stderr,"store: udata=%Hu\n",*(const hsize_t *)udata);
+#endif /* QAK */
+ return(SUCCEED);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: compare
+ *
+ * Purpose: Compare two native information records, according to some key
+ *
+ * Return: <0 if rec1 < rec2
+ * =0 if rec1 == rec2
+ * >0 if rec1 > rec2
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, February 3, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+compare(const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *rec1, const void *rec2)
+{
+#ifdef QAK
+HDfprintf(stderr,"compare: *rec1=%Hu, *rec2=%Hu\n",*(const hsize_t *)rec1,*(const hsize_t *)rec2);
+#endif /* QAK */
+ return(*(const hssize_t *)rec1-*(const hssize_t *)rec2);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: encode
+ *
+ * Purpose: Encode native information into raw form for storing on disk
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, February 3, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+encode(const H5F_t *f, uint8_t *raw, const void *nrecord)
+{
+ H5F_ENCODE_LENGTH(f, raw, *(const hsize_t *)nrecord);
+
+#ifdef QAK
+HDfprintf(stderr,"encode: data=%Hu\n",*(const hsize_t *)nrecord);
+#endif /* QAK */
+ return(SUCCEED);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_basic
+ *
+ * Purpose: Basic tests for the B-tree v2 code
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, February 3, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_basic_insert(hid_t fapl)
+{
+ hid_t file=-1;
+ char filename[1024];
+ H5F_t *f=NULL;
+ H5B2_class_t type={ /* B-tree class information */
+ 0, /* Type of B-tree */
+ sizeof(hsize_t), /* Size of native key */
+ store, /* Record storage callback */
+ compare, /* Record comparison callback */
+ encode /* Record encoding callback */
+ };
+ hsize_t record; /* Record to insert into tree */
+ haddr_t bt2_addr; /* Address of B-tree created */
+
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ /* Create the file to work on */
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR;
+
+ /* Get a pointer to the internal file object */
+ if (NULL==(f=H5I_object(file))) {
+ H5Eprint_stack(H5E_DEFAULT, stdout);
+ TEST_ERROR;
+ }
+
+ /*
+ * Test v2 B-tree creation
+ */
+ TESTING("B-tree creation");
+ if (H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &type, 512, 8, 100, 40, &bt2_addr/*out*/)<0) {
+ H5_FAILED();
+ H5Eprint_stack(H5E_DEFAULT, stdout);
+ TEST_ERROR;
+ }
+ PASSED();
+
+ /*
+ * Test inserting record into v2 B-tree
+ */
+ TESTING("B-tree insert");
+ record=42;
+ if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
+ H5_FAILED();
+ H5Eprint_stack(H5E_DEFAULT, stdout);
+ TEST_ERROR;
+ }
+
+ /*
+ * Test inserting second record into v2 B-tree, before all other records
+ */
+ record=34;
+ if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
+ H5_FAILED();
+ H5Eprint_stack(H5E_DEFAULT, stdout);
+ TEST_ERROR;
+ }
+
+ /*
+ * Test inserting third record into v2 B-tree, after all other records
+ */
+ record=56;
+ if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
+ H5_FAILED();
+ H5Eprint_stack(H5E_DEFAULT, stdout);
+ TEST_ERROR;
+ }
+
+ /*
+ * Test inserting fourth record into v2 B-tree, in the middle of other records
+ */
+ record=38;
+ if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
+ H5_FAILED();
+ H5Eprint_stack(H5E_DEFAULT, stdout);
+ TEST_ERROR;
+ }
+ PASSED();
+
+ if (H5Fclose(file)<0) TEST_ERROR;
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return 1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Test the B-tree v2 code
+ *
+ * Return: Success:
+ *
+ * Failure:
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, February 1, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ hid_t fapl=-1;
+ int nerrors=0;
+
+ /* Reset library */
+ h5_reset();
+ fapl = h5_fileaccess();
+
+ /* Test basic B-tree insertion */
+ nerrors += test_basic_insert(fapl);
+/* nerrors += test_many_insert(fapl); */
+
+ if (nerrors) goto error;
+ puts("All v2 B-tree tests passed.");
+#ifndef QAK
+ h5_cleanup(FILENAME, fapl);
+#else /* QAK */
+HDfprintf(stderr,"Uncomment cleanup!\n");
+#endif /* QAK */
+ return 0;
+
+error:
+ puts("*** TESTS FAILED ***");
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ } H5E_END_TRY;
+ return 1;
+}
+