diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-03-04 21:48:54 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-03-04 21:48:54 (GMT) |
commit | 831be556f4cca3b5f9380757ce4f09b40f13dd4b (patch) | |
tree | 3f2bc713513baded467df00f2cc8c966255b47fa /test/btree2.c | |
parent | 83cbb092ed97644bd042ef82d3645e2cdd5c125d (diff) | |
download | hdf5-831be556f4cca3b5f9380757ce4f09b40f13dd4b.zip hdf5-831be556f4cca3b5f9380757ce4f09b40f13dd4b.tar.gz hdf5-831be556f4cca3b5f9380757ce4f09b40f13dd4b.tar.bz2 |
[svn-r10148] Purpose:
New test
Description:
Add a couple more tests for removing records before I start modifying the
code further.
Platforms tested:
FreeBSD 4.11 (sleipnir)
Solaris 2.9 (shanti)
Diffstat (limited to 'test/btree2.c')
-rw-r--r-- | test/btree2.c | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/test/btree2.c b/test/btree2.c index 54a5da7..b9f28f9 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -2322,15 +2322,53 @@ test_remove_level1_noredistrib(hid_t fapl) /* Make certain that the # of records is correct */ if(nrec != ((INSERT_SPLIT_ROOT_NREC*2)-1)) TEST_ERROR; - /* Query the address of the root node in the B-tree */ - if (H5B2_get_root_addr(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &root_addr)<0) { + PASSED(); + + /* Attempt to remove a record from left leaf of a level-1 B-tree with noredistribution */ + TESTING("B-tree remove: record from left leaf of level-1 B-tree"); + record = 0; + if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) { H5_FAILED(); H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } /* end if */ - /* Make certain that the root node has not been freed */ - if(!H5F_addr_defined(root_addr)) TEST_ERROR; + /* Make certain that the record value is correct */ + if(record != 0) TEST_ERROR; + + /* Query the number of records in the B-tree */ + if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) { + H5_FAILED(); + H5Eprint_stack(H5E_DEFAULT, stdout); + goto error; + } /* end if */ + + /* Make certain that the # of records is correct */ + if(nrec != ((INSERT_SPLIT_ROOT_NREC*2)-2)) TEST_ERROR; + + PASSED(); + + /* Attempt to remove a record from middle leaf of a level-1 B-tree with noredistribution */ + TESTING("B-tree remove: record from middle leaf of level-1 B-tree"); + record = INSERT_SPLIT_ROOT_NREC; + if(H5B2_remove(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) { + H5_FAILED(); + H5Eprint_stack(H5E_DEFAULT, stdout); + goto error; + } /* end if */ + + /* Make certain that the record value is correct */ + if(record != INSERT_SPLIT_ROOT_NREC) TEST_ERROR; + + /* Query the number of records in the B-tree */ + if (H5B2_get_nrec(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &nrec)<0) { + H5_FAILED(); + H5Eprint_stack(H5E_DEFAULT, stdout); + goto error; + } /* end if */ + + /* Make certain that the # of records is correct */ + if(nrec != ((INSERT_SPLIT_ROOT_NREC*2)-3)) TEST_ERROR; PASSED(); |