public void PUT_UpdateContract([PexAssumeUnderTest] BinaryHeap.BinaryHeap <int, int> bh, int priority, int value) { //ahmad alternate semantics AssumePrecondition.IsTrue(true); int Old_bhCount = bh.Count; int Old_bhIndexOfValue = bh.IndexOf(value); int Old_bhMinimumKey = bh.Count > 0 ? bh.Minimum().Key : PexChoose.Value <int>("old_bhMinimumKey"); //int Old_bhMinimumKey = bh.Count > 0 ? bh.Minimum().Key : priority -1; int Old_bhMinimumValue = bh.Count > 0 ? bh.Minimum().Value : PexChoose.Value <int>("old_bhMinimumValue"); //int Old_bhMinimumValue = bh.Count > 0 ? bh.Minimum().Value : value -1; //int Old_bhMinimumKey = bh.Minimum().Key ; //int Old_bhMinimumValue = bh.Minimum().Value; int Old_priority = priority; int Old_value = value; //code bh.Update(priority, value); int New_bhCount = bh.Count; int New_bhIndexOfValue = bh.IndexOf(value); //int New_bhMinimumKey = bh.Minimum().Key; int New_bhMinimumKey = bh.Minimum().Key; //int New_bhMinimumValue = bh.Minimum().Value; int New_bhMinimumValue = bh.Minimum().Value; //int New_prioirty = priority; //int New_value = value; PexObserve.ValueForViewing("$old_bh_count", Old_bhCount); PexObserve.ValueForViewing("$new_bh_count", New_bhCount); PexObserve.ValueForViewing("$old_bh_indexof_value", Old_bhIndexOfValue); PexObserve.ValueForViewing("$new_bh_indexof_value", New_bhIndexOfValue); PexObserve.ValueForViewing("$old_bh_minimum_key", Old_bhMinimumKey); PexObserve.ValueForViewing("$new_bh_minimum_key", New_bhMinimumKey); PexObserve.ValueForViewing("$old_bh_minimum_value", Old_bhMinimumValue); PexObserve.ValueForViewing("$new_bh_minimum_value", New_bhMinimumValue); PexObserve.ValueForViewing("$old_bh_priority", Old_priority); //PexObserve.ValueForViewing("$new_bh_priority", New_prioirty); PexObserve.ValueForViewing("$old_bh_value", Old_value); //PexObserve.ValueForViewing("$new_bh_value", New_value); Assert.True(((Old_bhCount <= New_bhCount && New_bhMinimumKey <= Old_priority && (!(New_bhIndexOfValue == New_bhCount)) && (!(Old_bhIndexOfValue == Old_bhCount)) && Old_bhIndexOfValue <= Old_bhCount && New_bhIndexOfValue <= Old_bhCount && New_bhIndexOfValue >= 0 && Old_bhIndexOfValue >= -1))); }
public void PUT_UpdateContract([PexAssumeUnderTest] BinaryHeap.BinaryHeap <int, int> bh, int priority, int value) { AssumePrecondition.IsTrue(bh.IndexOf(value) >= 0); int Old_bhCount = bh.Count; int Old_bhCapacity = bh.Capacity; int Old_bhIndexOfValue = bh.IndexOf(value); //int Old_bhMinimumKey = bh.Count > 0 ? bh.Minimum().Key : PexChoose.Value<int>("old_bhMinimumKey"); //int Old_bhMinimumValue = bh.Count > 0 ? bh.Minimum().Value : PexChoose.Value<int>("old_bhMinimumValue"); int Old_bhMinimumKey = bh.Minimum().Key; int Old_bhMinimumValue = bh.Minimum().Value; int Old_prioirty = priority; int Old_value = value; //code bh.Update(priority, value); int New_bhCount = bh.Count; int New_bhCapacity = bh.Capacity; int Newd_bhIndexOfValue = bh.IndexOf(value); int New_bhMinimumKey = bh.Count > 0 ? bh.Minimum().Key : PexChoose.Value <int>("new_bhMinimumKey"); int New_bhMinimumValue = bh.Count > 0 ? bh.Minimum().Value : PexChoose.Value <int>("new_bhMinimumValue"); int New_prioirty = priority; int New_value = value; PexObserve.ValueForViewing("$old_bh_count", Old_bhCount); PexObserve.ValueForViewing("$new_bh_count", New_bhCount); PexObserve.ValueForViewing("$old_bh_capacity", Old_bhCapacity); PexObserve.ValueForViewing("$new_bh_capacity", New_bhCapacity); PexObserve.ValueForViewing("$old_bh_indexof_value", Old_bhIndexOfValue); PexObserve.ValueForViewing("$new_bh_indexof_value", Newd_bhIndexOfValue); PexObserve.ValueForViewing("$old_bh_minimum_key", Old_bhMinimumKey); PexObserve.ValueForViewing("$new_bh_minimum_key", New_bhMinimumKey); PexObserve.ValueForViewing("$old_bh_minimum_value", Old_bhMinimumValue); PexObserve.ValueForViewing("$new_bh_minimum_value", New_bhMinimumValue); PexObserve.ValueForViewing("$old_bh_priority", Old_prioirty); PexObserve.ValueForViewing("$new_bh_priority", New_prioirty); PexObserve.ValueForViewing("$old_bh_value", Old_value); PexObserve.ValueForViewing("$new_bh_value", New_value); Assert.IsTrue(false); }