summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-02-09 21:32:07 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-02-09 21:32:07 (GMT)
commit9f76f83f48271a3966e0afdaf25fcc412b402d4d (patch)
tree0303930db749054b87fa91f2db80cc187a1635d4 /test
parentf3d0c37f910e0b5e9cd4cd5fc5fa3885f0c3904d (diff)
downloadhdf5-9f76f83f48271a3966e0afdaf25fcc412b402d4d.zip
hdf5-9f76f83f48271a3966e0afdaf25fcc412b402d4d.tar.gz
hdf5-9f76f83f48271a3966e0afdaf25fcc412b402d4d.tar.bz2
[svn-r9971] Purpose:
New feature Description: Checkpoint v2 B-tree code after getting 2 leaf record redistribution working and tested. Platforms tested: FreeBSD 4.11 (sleipnir) w/parallel Too minor to require h5committest
Diffstat (limited to 'test')
-rw-r--r--test/btree2.c45
1 files changed, 39 insertions, 6 deletions
diff --git a/test/btree2.c b/test/btree2.c
index 6366147..1a10927 100644
--- a/test/btree2.c
+++ b/test/btree2.c
@@ -268,7 +268,7 @@ test_insert_level1_2leaf_redistrib(hid_t fapl)
}
/*
- * Test v2 B-tree creation
+ * Create v2 B-tree
*/
if (H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/)<0) {
H5_FAILED();
@@ -279,8 +279,9 @@ test_insert_level1_2leaf_redistrib(hid_t fapl)
/*
* Test inserting many records into v2 B-tree
*/
- TESTING("B-tree many - redistribute 2 leaves in level 1 B-tree");
+ TESTING("B-tree many - redistribute 2 leaves in level 1 B-tree (l->r)");
+ /* Insert enough records to force root to split into 2 leaves */
for(u=0; u<INSERT_SPLIT_ROOT_NREC; u++) {
record=u+INSERT_SPLIT_ROOT_NREC/2;
if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
@@ -289,6 +290,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl)
goto error;
}
}
+
+ /* Force redistribution from left node into right node */
for(u=0; u<INSERT_SPLIT_ROOT_NREC/2; u++) {
record=u;
if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
@@ -297,7 +300,41 @@ test_insert_level1_2leaf_redistrib(hid_t fapl)
goto error;
}
}
+ PASSED();
+ /*
+ * Create v2 B-tree
+ */
+ if (H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/)<0) {
+ H5_FAILED();
+ H5Eprint_stack(H5E_DEFAULT, stdout);
+ goto error;
+ }
+
+ /*
+ * Test inserting many records into v2 B-tree
+ */
+ TESTING("B-tree many - redistribute 2 leaves in level 1 B-tree (r->l)");
+
+ /* Insert enough records to force root to split into 2 leaves */
+ for(u=0; u<INSERT_SPLIT_ROOT_NREC; u++) {
+ record=u;
+ if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ H5_FAILED();
+ H5Eprint_stack(H5E_DEFAULT, stdout);
+ goto error;
+ }
+ }
+
+ /* Force redistribution from left node into right node */
+ for(u=0; u<INSERT_SPLIT_ROOT_NREC/2; u++) {
+ record=u+INSERT_SPLIT_ROOT_NREC;
+ if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
+ H5_FAILED();
+ H5Eprint_stack(H5E_DEFAULT, stdout);
+ goto error;
+ }
+ }
PASSED();
if (H5Fclose(file)<0) TEST_ERROR;
@@ -341,11 +378,7 @@ main(void)
/* Test basic B-tree insertion */
nerrors += test_insert_basic(fapl);
nerrors += test_insert_split_root(fapl);
-#ifdef QAK
nerrors += test_insert_level1_2leaf_redistrib(fapl);
-#else /* QAK */
-HDfprintf(stderr,"Uncomment test!\n");
-#endif /* QAK */
if (nerrors) goto error;
puts("All v2 B-tree tests passed.");