Esempio n. 1
0
        public void DeleteNonExistingBtreeNode()
        {
            var btree = new BTree <int, int>(Degree);

            for (int i = 0; i < this.testKeyData.Length; i++)
            {
                this.InsertTestData(btree, i);
            }

            btree.Delete(99999);
            TreeValidation.ValidateTree(btree.Root, Degree, this.testKeyData.ToArray());
        }
Esempio n. 2
0
        public void InsertOneBtreeNode()
        {
            var btree = new BTree <int, int>(Degree);

            btree.Insert(this.testKeyData[0], this.testPointerData[0]);
            TreeValidation.ValidateTree(btree.Root, Degree, this.testKeyData.Take(0 + 1).ToArray());

            btree.Insert(this.testKeyData[1], this.testPointerData[1]);
            TreeValidation.ValidateTree(btree.Root, Degree, this.testKeyData.Take(1 + 1).ToArray());

            foreach (var item in btree.Root.Entries)
            {
                Console.WriteLine("clé" + item.Key);
                Console.WriteLine("pointeur" + item.Pointer);
            }
            //Assert.AreEqual(1, btree.Height);
        }
Esempio n. 3
0
        public void DeleteBtreeNodes()
        {
            var btree = new BTree <int, int>(Degree);

            for (int i = 0; i < this.testKeyData.Length; i++)
            {
                this.InsertTestData(btree, i);
            }

            for (int i = 0; i < this.testKeyData.Length; i++)
            {
                btree.Delete(this.testKeyData[i]);
                TreeValidation.ValidateTree(btree.Root, Degree, this.testKeyData.Skip(i + 1).ToArray());
            }

            Assert.AreEqual(1, btree.Height);
        }
Esempio n. 4
0
 private void InsertTestDataAndValidateTree(BTree <int, int> btree, int testDataIndex)
 {
     btree.Insert(this.testKeyData[testDataIndex], this.testPointerData[testDataIndex]);
     TreeValidation.ValidateTree(btree.Root, Degree, this.testKeyData.Take(testDataIndex + 1).ToArray());
 }