/// <exception cref="System.Exception"></exception>
        private BTree CycleIntKeys(BTree btree)
        {
            AddKeys(btree);
            ExpectKeys(btree, _sortedKeys);
            btree.Commit(Trans());
            ExpectKeys(btree, _sortedKeys);
            RemoveKeys(btree);
            ExpectKeys(btree, _keysOnRemoval);
            btree.Rollback(Trans());
            ExpectKeys(btree, _sortedKeys);
            int id = btree.GetID();

            Reopen();
            btree = BTreeAssert.CreateIntKeyBTree(Container(), id, BtreeNodeSize);
            ExpectKeys(btree, _sortedKeys);
            RemoveKeys(btree);
            ExpectKeys(btree, _keysOnRemoval);
            btree.Commit(Trans());
            ExpectKeys(btree, _keysOnRemoval);
            // remove all but 1
            for (int i = 1; i < _keysOnRemoval.Length; i++)
            {
                btree.Remove(Trans(), _keysOnRemoval[i]);
            }
            ExpectKeys(btree, _one);
            btree.Commit(Trans());
            ExpectKeys(btree, _one);
            btree.Remove(Trans(), 1);
            btree.Rollback(Trans());
            ExpectKeys(btree, _one);
            btree.Remove(Trans(), 1);
            btree.Commit(Trans());
            ExpectKeys(btree, _none);
            return(btree);
        }
        /// <exception cref="System.Exception"></exception>
        public virtual void TestIntKeys()
        {
            BTree btree = BTreeAssert.CreateIntKeyBTree(Container(), 0, BtreeNodeSize);

            for (int i = 0; i < 5; i++)
            {
                btree = CycleIntKeys(btree);
            }
        }
Ejemplo n.º 3
0
        /// <exception cref="System.Exception"></exception>
        private void CycleIntKeys(int[] values)
        {
            BTree btree = BTreeAssert.CreateIntKeyBTree(Container(), 0, BtreeNodeSize);

            for (int i = 0; i < 5; i++)
            {
                btree = CycleIntKeys(btree, values);
            }
        }
Ejemplo n.º 4
0
        /// <exception cref="System.Exception"></exception>
        private BTree CycleIntKeys(BTree btree, int[] values)
        {
            for (int i = 0; i < values.Length; i++)
            {
                btree.Add(Trans(), values[i]);
            }
            ExpectKeysSearch(Trans(), btree, values);
            btree.Commit(Trans());
            int id = btree.GetID();

            Container().Commit(Trans());
            Reopen();
            btree = BTreeAssert.CreateIntKeyBTree(Container(), id, BtreeNodeSize);
            ExpectKeysSearch(Trans(), btree, values);
            for (int i = 0; i < values.Length; i++)
            {
                btree.Remove(Trans(), values[i]);
            }
            BTreeAssert.AssertEmpty(Trans(), btree);
            btree.Commit(Trans());
            BTreeAssert.AssertEmpty(Trans(), btree);
            return(btree);
        }
Ejemplo n.º 5
0
 protected virtual BTree NewBTree()
 {
     return(BTreeAssert.CreateIntKeyBTree(Container(), 0, BtreeNodeSize));
 }
Ejemplo n.º 6
0
 private BTree NewBTreeWithNoNodeCaching()
 {
     return(BTreeAssert.CreateIntKeyBTree(Container(), 0, BtreeNodeSize));
 }