Ejemplo n.º 1
0
        public void hashCodeComparerIntTest()
        {
            Oid id;

            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                Placement place = new Placement(222, 1, 1, UInt16.MaxValue, UInt16.MaxValue);
                session.BeginUpdate();
                HashCodeComparer <int> hashCodeComparer = new HashCodeComparer <int>();
                BTreeSet <int>         bTree            = new BTreeSet <int>(hashCodeComparer, session);
                bTree.Persist(place, session);
                id = bTree.Oid;
                for (int i = 0; i < 100000; i++)
                {
                    bTree.Add(i);
                }
                bTree.Clear();
                for (int i = 0; i < 100000; i++)
                {
                    bTree.Add(i);
                }
                session.Commit();
                session.Compact();
            }
            using (SessionNoServer session = new SessionNoServer(systemDir))
            {
                session.BeginRead();
                BTreeSet <int> bTree = (BTreeSet <int>)session.Open(id);
                int            count = 0;
                foreach (int num in bTree)
                {
                    count++;
                }
                Assert.True(100000 == count);
                session.Commit();
            }
        }
Ejemplo n.º 2
0
 public void hashCodeComparerIntTest()
 {
   Oid id;
   using (SessionNoServer session = new SessionNoServer(systemDir))
   {
     Placement place = new Placement(222, 1, 1, UInt16.MaxValue, UInt16.MaxValue);
     session.BeginUpdate();
     HashCodeComparer<int> hashCodeComparer = new HashCodeComparer<int>();
     BTreeSet<int> bTree = new BTreeSet<int>(hashCodeComparer, session);
     bTree.Persist(place, session);
     id = bTree.Oid;
     for (int i = 0; i < 100000; i++)
     {
       bTree.Add(i);
     }
     bTree.Clear();
     for (int i = 0; i < 100000; i++)
     {
       bTree.Add(i);
     }        
     session.Commit();
     session.Compact();
   }
   using (SessionNoServer session = new SessionNoServer(systemDir))
   {
     session.BeginRead();
     BTreeSet<int> bTree= (BTreeSet<int>)session.Open(id);
     int count = 0;
     foreach (int num in bTree)
     {
       count++;
     }
     Assert.True(100000 == count);
     session.Commit();
   }
 }