Пример #1
0
        public virtual void Test01()
        {
            var baseName = GetBaseName();
            DeleteBase(baseName);
            var persister = GetPersister(baseName);
            IBTree tree = new OdbBtreeMultiple(2, persister);
            var start = OdbTime.GetCurrentTimeInMs();
            for (var i = 0; i < Size; i++)
                tree.Insert(i + 1, "value " + (i + 1));

            var end = OdbTime.GetCurrentTimeInMs();
            Println("time/object=" + (end - start) / (float) Size);

            AssertTrue((end - start) < 3000);

            AssertEquals(Size, tree.GetSize());
            var iterator = tree.Iterator<object>(OrderByConstants.OrderByAsc);
            var j = 0;
            while (iterator.MoveNext())
            {
                var o = iterator.Current;
                AssertEquals("value " + (j + 1), o);
                j++;
                if (j % 10 == 0)
                    Println(j);
            }
            persister.Close();
            DeleteBase(baseName);
        }
Пример #2
0
 public virtual void Test1()
 {
     var baseName = GetBaseName();
     var persister = GetPersister(baseName);
     IBTree tree = new OdbBtreeMultiple(2, persister);
     var start = OdbTime.GetCurrentTimeInMs();
     for (var i = 0; i < Size; i++)
         tree.Insert(i + 1, "value " + (i + 1));
     var end = OdbTime.GetCurrentTimeInMs();
     Println(end - start);
     if (testPerformance)
         AssertTrue((end - start) < 0.34 * Size);
     // println("insert of "+SIZE+" elements in BTREE = " +
     // (end-start)+"ms");
     // persister.close();
     // persister = getPersister();
     AssertEquals(Size, tree.GetSize());
     var iterator = tree.Iterator<object>(OrderByConstants.OrderByAsc);
     var j = 0;
     while (iterator.MoveNext())
     {
         var o = iterator.Current;
         AssertEquals("value " + (j + 1), o);
         j++;
         if (j % 10 == 0)
             Println(j);
     }
     persister.Close();
     DeleteBase(baseName);
 }
Пример #3
0
 public virtual void Test2()
 {
     var baseName = GetBaseName();
     var persister = GetPersister(baseName);
     IBTree tree = new OdbBtreeMultiple(2, persister);
     for (var i = 0; i < Size; i++)
         tree.Insert(i + 1, "value " + (i + 1));
     AssertEquals(Size, tree.GetSize());
     var iterator = tree.Iterator<object>(OrderByConstants.OrderByDesc);
     var j = 0;
     while (iterator.MoveNext())
     {
         var o = iterator.Current;
         // println(o);
         j++;
         if (j == Size)
             AssertEquals("value " + 1, o);
     }
     persister.Close();
     DeleteBase(baseName);
 }
Пример #4
0
        public virtual void Test1a()
        {
            var baseName = GetBaseName();

            var persister = GetPersister(baseName);
            IBTree tree = new OdbBtreeMultiple(2, persister);
            for (var i = 0; i < Size; i++)
                tree.Insert(i + 1, "value " + (i + 1));
            // println(new BTreeDisplay().build(tree,true).toString());
            persister.Close();
            persister = GetPersister(baseName);
            tree = persister.LoadBTree(tree.GetId());
            // println(new BTreeDisplay().build(tree,true).toString());
            AssertEquals(Size, tree.GetSize());
            var iterator = tree.Iterator<object>(OrderByConstants.OrderByAsc);
            var j = 0;
            while (iterator.MoveNext())
            {
                var o = iterator.Current;
                AssertEquals("value " + (j + 1), o);
                j++;
                if (j == Size)
                    AssertEquals("value " + Size, o);
            }
            persister.Close();
            DeleteBase(baseName);
        }