Beispiel #1
0
        public void Merge_WithNonEmpty_ClearsArgument()
        {
            var heap  = new PairingHeap <int>();
            var other = new PairingHeap <int>();

            other.Insert(0);
            heap.Merge(other);
            Assert.That(other.IsEmpty, Is.True);
        }
Beispiel #2
0
        public void Merge_WithNonEmpty_CountChanged()
        {
            var heap  = new PairingHeap <int>();
            var other = new PairingHeap <int>();

            other.Insert(0);
            heap.Merge(other);
            Assert.That(heap.Count(), Is.EqualTo(1));
        }
Beispiel #3
0
        public void Merge_TwoNonEmpty_ExtractsAllElementsCorrectly()
        {
            var heap = new PairingHeap <int>();

            heap.Insert(0);
            heap.Insert(2);

            var other = new PairingHeap <int>();

            other.Insert(1);
            other.Insert(3);

            heap.Merge(other);
            Assert.That(ExtractAll(heap), Is.EqualTo(new[] { 0, 1, 2, 3 }));
        }