Ejemplo n.º 1
0
        public static void Consolidate_EmptyHeap_DoesNothing()
        {
            var heap = new TestFHeap();

            heap.RawConsolidate();

            Assert.Throws <InvalidOperationException>(() => heap.Peek());
        }
Ejemplo n.º 2
0
        public static void Cut_EmptyHeap_ThrowsCorrectExcpetion()
        {
            var heap  = new TestFHeap();
            var item1 = new FHeapNode <int>(1);
            var item2 = new FHeapNode <int>(2);

            Assert.Throws <InvalidOperationException>(() => heap.RawCut(item1, item2));
        }
Ejemplo n.º 3
0
        public static void Cut_FilledHeap_AlteredItem()
        {
            var heap  = new TestFHeap();
            var item1 = heap.Push(1);
            var item2 = heap.Push(2);

            item2.Degree = -1;

            Assert.Throws <InvalidOperationException>(() => heap.RawCut(item1, item2));
        }