コード例 #1
0
ファイル: BTreeTest.cs プロジェクト: jamesjrg/taipan
        public void BTreeConstructorTest()
        {
            //check it can be closed and reopened again
            int id = 1;
            int key = 2;

            BTree target = new BTree(id, true);
            target.Insert(key);
            target.Dispose();
            target = new BTree(id, false);
            Assert.AreEqual("I:0:K:3", target.Search(key).ToString());

            //ensure truncation works
            target = new BTree(id, true);
            Assert.AreEqual(null, target.Search(key));
        }
コード例 #2
0
ファイル: BTreeTest.cs プロジェクト: jamesjrg/taipan
        public void InsertTest()
        {
            int id = 1;
            int firstKey = 1;

            BTree target = new BTree(id, true);

            //simple
            target.Insert(firstKey);
            Assert.AreEqual("I:0:K:1;", target.Search(firstKey).ToString());

            //max keys in a single node
            for (int i = 1; i != BTree.MAX_KEYS; ++i)
                target.Insert(i + 1);
            Assert.AreEqual("I:0:K:1,2,3,4,5,6,7;", target.Dump());

            //and one more
            target.Insert(BTree.MAX_KEYS + 1);
            Assert.AreEqual("I:0:K:1,2,3;  I:1:K:4;  I:2:K:5,6,7,8;", target.Dump());
        }
コード例 #3
0
ファイル: BTreeTest.cs プロジェクト: jamesjrg/taipan
 public void SearchTest()
 {
     int id = 0; // TODO: Initialize to an appropriate value
     bool truncate = false; // TODO: Initialize to an appropriate value
     BTree target = new BTree(id, truncate); // TODO: Initialize to an appropriate value
     int k = 0; // TODO: Initialize to an appropriate value
     BTree.NodeIndexPair expected = null; // TODO: Initialize to an appropriate value
     BTree.NodeIndexPair actual;
     actual = target.Search(k);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }