public void Test_Update_Max_Throws_Argument() { IndexedHeap <string> heap = new IndexedHeap <string>(HeapMode.MaxHeap, 1); heap.Add("test"); Assert.Throws <ArgumentException>(() => heap.Update(1, "not test")); }
public void Test_Update_Min() { IndexedHeap <byte> heap = (IndexedHeap <byte>) this.CreateInstance(HeapMode.MinHeap, 5); heap.Add(10); heap.Add(20); heap.Add(30); heap.Add(40); heap.Add(50); int index = heap.GetIndex(40); heap.Update(index, 5); Assert.Equal(1, heap.GetIndex(5)); Assert.Equal(2, heap.GetIndex(10)); }
public void Test_Update_Max_Throws_ArgumentOutOfRange() { IndexedHeap <byte> heap = (IndexedHeap <byte>) this.CreateInstance(HeapMode.MaxHeap, 1); Assert.Throws <ArgumentOutOfRangeException>(() => heap.Update(100, default)); }