Exemplo n.º 1
0
        public void GivenKeepMin2Items_AddInReverseOrder_ShouldHold3Not4()
        {
            _intHeap = BinaryMinHeap <int> .CreateWithSizeLimit(new IntComparer(), 2);

            Assert.AreEqual(0, _intHeap.Add(4));
            Assert.AreEqual(0, _intHeap.Add(3));
            Assert.AreEqual(0, _intHeap.Add(2));

            // level 2 is now full, should discard on next add
            Assert.AreEqual(4, _intHeap.Add(1));
        }