コード例 #1
0
 public void Append01()
 {
     var person1 = new Person { Age = 1 };
     var person2 = new Person { Age = 1 };
     var minheap = new MinHeap<Person, int>(2, x => x.Age);
     minheap.Append(person1);
     minheap.Append(person2);
     foreach (var x in minheap) { break; }
     Assert.AreEqual(person1, minheap.Peek());
     Assert.AreNotEqual(person2, minheap.Peek());
 }
コード例 #2
0
        public void Append01()
        {
            var person1 = new Person {
                Age = 1
            };
            var person2 = new Person {
                Age = 1
            };
            var minheap = new MinHeap <Person, int>(2, x => x.Age);

            minheap.Append(person1);
            minheap.Append(person2);
            foreach (var x in minheap)
            {
                break;
            }
            Assert.AreEqual(person1, minheap.Peek());
            Assert.AreNotEqual(person2, minheap.Peek());
        }