public void PUT_AddContract([PexAssumeUnderTest] BinaryHeap.BinaryHeap <int, int> bh, int priority, int value) { AssumePrecondition.IsTrue(true); 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_prioirty = priority; int Old_value = value; //code bh.Add(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); }
public void PUT_AddContract([PexAssumeUnderTest] BinaryHeap.BinaryHeap <int, int> bh, int key, int value) { AssumePrecondition.IsTrue(true); int Old_bhCount = bh.Count; //int Old_bhCapacity = bh.Capacity; 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.Count > 0 ? bh.Minimum().Key : key + 1; //PexChoose.Value<int>("old_bhMinimumKey"); //int Old_bhMinimumValue = bh.Count > 0 ? bh.Minimum().Value : value + 1; //PexChoose.Value<int>("old_bhMinimumValue"); int Old_bhIndexOfValue = bh.IndexOf(value); int Old_key = key; int Old_value = value; //code bh.Add(key, value); int New_bhCount = bh.Count; //int New_bhCapacity = bh.Capacity; int New_bhMinimumKey = bh.Minimum().Key; // bh.Count > 0 ? bh.Minimum().Key : PexChoose.Value<int>("new_bhMinimumKey"); int New_bhMinimumValue = bh.Minimum().Value; //bh.Count > 0 ? bh.Minimum().Value : PexChoose.Value<int>("new_bhMinimumValue"); int New_bhIndexOfValue = bh.IndexOf(value); PexObserve.ValueForViewing("$old_bh_count", Old_bhCount); PexObserve.ValueForViewing("$new_bh_count", New_bhCount); PexObserve.ValueForViewing("$old_bh_key", Old_key); PexObserve.ValueForViewing("$old_bh_value", Old_value); //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", 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); Assert.True(((New_bhMinimumKey <= Old_key && New_bhCount == 1 + Old_bhCount && (!(Old_bhIndexOfValue == Old_bhCount)) && Old_bhIndexOfValue <= Old_bhCount && New_bhIndexOfValue <= Old_bhCount && New_bhIndexOfValue >= 0 && Old_bhIndexOfValue >= -1))); }