public void InsertAndRemoveMinimum <TPriority, TValue>( [PexAssumeUnderTest] BinaryHeap <TPriority, TValue> target, [PexAssumeNotNull] KeyValuePair <TPriority, TValue>[] kvs) { var count = target.Count; foreach (var kv in kvs) { target.Add(kv.Key, kv.Value); } TPriority minimum = default(TPriority); for (int i = 0; i < kvs.Length; ++i) { if (i == 0) { minimum = target.RemoveMinimum().Key; } else { var m = target.RemoveMinimum().Key; Assert.IsTrue(target.PriorityComparison(minimum, m) <= 0); minimum = m; } AssertInvariant(target); } Assert.AreEqual(0, target.Count); }
public void Operations <TPriority, TValue>( [PexAssumeUnderTest] BinaryHeap <TPriority, TValue> target, [PexAssumeNotNull] KeyValuePair <bool, TPriority>[] values) { foreach (var value in values) { if (value.Key) { target.Add(value.Value, default(TValue)); } else { var min = target.RemoveMinimum(); } AssertInvariant <TPriority, TValue>(target); } }
private void Operations <TPriority, TValue>( BinaryHeap <TPriority, TValue> target, KeyValuePair <bool, TPriority>[] values) { foreach (var value in values) { if (value.Key) { target.Add(value.Value, default(TValue)); } else { var min = target.RemoveMinimum(); } AssertInvariant <TPriority, TValue>(target); } }