Exemplo n.º 1
0
        /// <exception cref="System.Exception"></exception>
        public static void AssertAllSlotsFreed(LocalTransaction trans, BTree bTree, ICodeBlock
                                               block)
        {
            LocalObjectContainer   container  = (LocalObjectContainer)trans.Container();
            ITransactionalIdSystem idSystem   = trans.IdSystem();
            IEnumerator            allSlotIDs = bTree.AllNodeIds(trans.SystemTransaction());
            Collection4            allSlots   = new Collection4();

            while (allSlotIDs.MoveNext())
            {
                int  slotID = ((int)allSlotIDs.Current);
                Slot slot   = idSystem.CurrentSlot(slotID);
                allSlots.Add(slot);
            }
            Slot bTreeSlot = idSystem.CurrentSlot(bTree.GetID());

            allSlots.Add(bTreeSlot);
            Collection4       freedSlots       = new Collection4();
            IFreespaceManager freespaceManager = container.FreespaceManager();

            container.InstallDebugFreespaceManager(new FreespaceManagerForDebug(new _ISlotListener_99
                                                                                    (freedSlots)));
            block.Run();
            container.InstallDebugFreespaceManager(freespaceManager);
            Assert.IsTrue(freedSlots.ContainsAll(allSlots.GetEnumerator()));
        }
Exemplo n.º 2
0
        public virtual void TestContainsAll()
        {
            Collection4TestCase.Item a  = new Collection4TestCase.Item(42);
            Collection4TestCase.Item b  = new Collection4TestCase.Item(a.id + 1);
            Collection4TestCase.Item c  = new Collection4TestCase.Item(b.id + 1);
            Collection4TestCase.Item a_ = new Collection4TestCase.Item(a.id);
            Collection4 needle          = new Collection4();
            Collection4 haystack        = new Collection4();

            haystack.Add(a);
            needle.Add(a);
            needle.Add(b);
            Assert.IsFalse(haystack.ContainsAll(needle));
            needle.Remove(b);
            Assert.IsTrue(haystack.ContainsAll(needle));
            needle.Add(b);
            haystack.Add(b);
            Assert.IsTrue(haystack.ContainsAll(needle));
            needle.Add(a_);
            Assert.IsTrue(haystack.ContainsAll(needle));
            needle.Add(c);
            Assert.IsFalse(haystack.ContainsAll(needle));
            needle.Clear();
            Assert.IsTrue(haystack.ContainsAll(needle));
            haystack.Clear();
            Assert.IsTrue(haystack.ContainsAll(needle));
        }
Exemplo n.º 3
0
        public virtual void TestContainsAll()
        {
            var a        = new Item(42);
            var b        = new Item(a.id + 1);
            var c        = new Item(b.id + 1);
            var a_       = new Item(a.id);
            var needle   = new Collection4();
            var haystack = new Collection4();

            haystack.Add(a);
            needle.Add(a);
            needle.Add(b);
            Assert.IsFalse(haystack.ContainsAll(needle));
            needle.Remove(b);
            Assert.IsTrue(haystack.ContainsAll(needle));
            needle.Add(b);
            haystack.Add(b);
            Assert.IsTrue(haystack.ContainsAll(needle));
            needle.Add(a_);
            Assert.IsTrue(haystack.ContainsAll(needle));
            needle.Add(c);
            Assert.IsFalse(haystack.ContainsAll(needle));
            needle.Clear();
            Assert.IsTrue(haystack.ContainsAll(needle));
            haystack.Clear();
            Assert.IsTrue(haystack.ContainsAll(needle));
        }