[!tip]
代码都在top/xianghua/mydb/server/im/BPlusTreeTest.java中
运行如下单位测试,得到测试效果
- public class BPlusTreeTest {
- @Test
- public void testTreeSingle() throws Exception {
- TransactionManager tm = new MockTransactionManager();
- DataManager dm = DataManager.create("E:\\temp\\TestTreeSingle", PageCache.PAGE_SIZE*10, tm);
- long root = BPlusTree.create(dm);
- BPlusTree tree = BPlusTree.load(root, dm);
- int lim = 10000;
- for(int i = lim-1; i >= 0; i --) {
- tree.insert(i, i);
- }
- tree.insert(10000, 10000);
- for(int i = 0; i < lim; i ++) {
- List<Long> uids = tree.search(i);
- assert uids.size() == 1;
- assert uids.get(0) == i;
- }
- assert new File("/tmp/TestTreeSingle.db").delete();
- assert new File("/tmp/TestTreeSingle.log").delete();
- }
- }
复制代码 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |