public void PUT_IndexOfContract([PexAssumeUnderTest] BinaryHeap.BinaryHeap <int, int> bh, int value) { // ahmad you can do this one: alternate semantics is that old ket and new key are the same; The same holds true for value AssumePrecondition.IsTrue(true); int Old_bhCount = bh.Count; 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_value = value; //code int New_Ret = bh.IndexOf(value); int New_bhCount = bh.Count; 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"); PexObserve.ValueForViewing("$old_bh_count", Old_bhCount); PexObserve.ValueForViewing("$new_bh_count", New_bhCount); 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_value", Old_value); PexObserve.ValueForViewing("$new_ret", New_Ret); Assert.True((((!(New_Ret == Old_bhCount)) && New_Ret <= Old_bhCount && Old_bhCount <= New_bhCount && New_bhCount <= Old_bhCount && New_Ret >= -1))); }
public void PUT_RemoveContract([PexAssumeUnderTest] HashSet.HashSet <int> hs, int x) { AssumePrecondition.IsTrue(true); int Old_hsCount = hs.Count; int Old_x = x; bool Old_hsContainsX = hs.Contains(x); bool New_Ret = hs.Remove(x); int New_hsCount = hs.Count; int New_x = x; bool New_hsContainsX = hs.Contains(x); PexObserve.ValueForViewing("$old_hs_Count", Old_hsCount); PexObserve.ValueForViewing("$new_hs_Count", New_hsCount); PexObserve.ValueForViewing("$old_hs_x", Old_x); PexObserve.ValueForViewing("$new_hs_x", New_x); PexObserve.ValueForViewing("$New_ret", New_Ret); PexObserve.ValueForViewing("$old_hs_contains_x", Old_hsContainsX); PexObserve.ValueForViewing("$new_hs_contains_x", New_hsContainsX); Assert.True(((New_x == Old_x && (!(New_hsContainsX))) && ((((New_Ret && New_hsCount == Old_hsCount - 1 && New_hsCount != Old_hsCount) && (((New_hsCount == Old_x && Old_x != Old_hsCount && New_x != Old_hsCount && Old_x == New_hsCount) && New_x == New_hsCount) || ((Old_x != New_hsCount && New_x != New_hsCount) && (!(New_x == New_hsCount))))) && Old_hsContainsX) || (((New_hsCount == Old_hsCount && (!(New_Ret))) && (((New_x == Old_hsCount && Old_x == Old_hsCount && Old_x == New_hsCount) && New_x == New_hsCount) || ((Old_x != Old_hsCount && New_x != Old_hsCount && Old_x != New_hsCount && New_x != New_hsCount) && (!(New_x == New_hsCount))))) && (!(Old_hsContainsX)))))); }
public void PUT_ContainsContract([PexAssumeUnderTest] ArrayList arrList, int x) { AssumePrecondition.IsTrue(true); int Old_arrListCount = arrList.Count; int Old_x = x; //bool Old_Ret = PexChoose.VarrListue<bool>("default_Ret"); int Old_arrListIndexOfX = arrList.IndexOf(x); int Old_arrListLastIndexOfX = arrList.LastIndexOf(x); bool Old_arrListContainsX = arrList.Contains(x); bool New_Ret = arrList.Contains(x); int New_arrListCount = arrList.Count; int New_x = x; int New_arrListIndexOfX = arrList.IndexOf(x); int New_arrListLastIndexOfX = arrList.LastIndexOf(x); bool New_arrListContainsX = arrList.Contains(x); PexObserve.ValueForViewing("$old_arrList_Count", Old_arrListCount); PexObserve.ValueForViewing("$new_arrList_Count", New_arrListCount); PexObserve.ValueForViewing("$old_arrList_x", Old_x); PexObserve.ValueForViewing("$new_arrList_x", New_x); PexObserve.ValueForViewing("$old_arrList_IndexOf_x", Old_arrListIndexOfX); PexObserve.ValueForViewing("$new_arrList_IndexOf_x", New_arrListIndexOfX); PexObserve.ValueForViewing("$old_arrList_LastIndexOf_x", Old_arrListLastIndexOfX); PexObserve.ValueForViewing("$new_arrList_LastIndexOf_x", New_arrListLastIndexOfX); //PexObserve.ValueForViewing("$Old_ret", Old_Ret); PexObserve.ValueForViewing("$New_ret", New_Ret); PexObserve.ValueForViewing("$old_arrList_contains_x", Old_arrListContainsX); PexObserve.ValueForViewing("$new_arrList_contains_x", New_arrListContainsX); Assert.True(((New_arrListCount == Old_arrListCount && New_x == Old_x && New_arrListIndexOfX == Old_arrListIndexOfX && New_arrListLastIndexOfX == Old_arrListLastIndexOfX && Old_arrListIndexOfX != Old_arrListCount && New_arrListIndexOfX != Old_arrListCount && Old_arrListLastIndexOfX != Old_arrListCount && New_arrListLastIndexOfX != Old_arrListCount && Old_arrListIndexOfX != New_arrListCount && New_arrListIndexOfX != New_arrListCount && Old_arrListLastIndexOfX != New_arrListCount && New_arrListLastIndexOfX != New_arrListCount) && ((((New_Ret && Old_arrListContainsX) && (((New_arrListLastIndexOfX == Old_arrListIndexOfX && Old_arrListLastIndexOfX == Old_arrListIndexOfX && Old_arrListLastIndexOfX == New_arrListIndexOfX) && New_arrListLastIndexOfX == New_arrListIndexOfX) || ((New_arrListIndexOfX == 0 && Old_arrListLastIndexOfX != Old_arrListIndexOfX && New_arrListLastIndexOfX != Old_arrListIndexOfX && Old_arrListLastIndexOfX != New_arrListIndexOfX && New_arrListLastIndexOfX != New_arrListIndexOfX) && (!(New_arrListLastIndexOfX == New_arrListIndexOfX))))) && New_arrListContainsX) || (((New_arrListLastIndexOfX == Old_arrListIndexOfX && (!(New_Ret)) && (!(Old_arrListContainsX)) && Old_arrListLastIndexOfX == Old_arrListIndexOfX && Old_arrListLastIndexOfX == New_arrListIndexOfX && New_arrListLastIndexOfX == New_arrListIndexOfX) && (((New_x == Old_arrListCount && Old_x == Old_arrListCount && Old_x == New_arrListCount && Old_arrListIndexOfX != Old_x && New_arrListIndexOfX != Old_x && Old_arrListLastIndexOfX != Old_x && New_arrListLastIndexOfX != Old_x && Old_arrListIndexOfX != New_x && New_arrListIndexOfX != New_x && Old_arrListLastIndexOfX != New_x && New_arrListLastIndexOfX != New_x) && New_x == New_arrListCount) || ((Old_x != Old_arrListCount && New_x != Old_arrListCount && Old_x != New_arrListCount && New_x != New_arrListCount) && (!(New_x == New_arrListCount))))) && (!(New_arrListContainsX)))))); }
public void PUT_RemoveMinimumContract([PexAssumeUnderTest] BinaryHeap.BinaryHeap <int, int> bh) { AssumePrecondition.IsTrue(bh.Count > 0); int Old_bhCount = bh.Count; int Old_bhCapacity = bh.Capacity; int Old_bhMinimumKey = bh.Minimum().Key; int Old_bhMinimumValue = bh.Minimum().Value; //code var rm = bh.RemoveMinimum(); int New_Ret_Key = rm.Key; int New_Ret_Value = rm.Value; int New_bhCount = bh.Count; int New_bhCapacity = bh.Capacity; 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"); 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_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("$new_ret_key", New_Ret_Key); PexObserve.ValueForViewing("$new_ret_value", New_Ret_Value); Assert.IsTrue(false); }
public void PUT_ContainsKeyContract([PexAssumeUnderTest] Dictionary.Dictionary <int, int> d, int x) { AssumePrecondition.IsTrue(true); int Old_dCount = d.Count; int Old_x = x; //bool Old_Ret = PexChoose.Value<bool>("default_Ret"); bool Old_dContainsKeyX = d.ContainsKey(x); bool New_Ret = d.ContainsKey(x); int New_dCount = d.Count; int New_x = x; bool New_dContainsKeyX = d.ContainsKey(x); PexObserve.ValueForViewing("$old_d_Count", Old_dCount); PexObserve.ValueForViewing("$new_d_Count", New_dCount); PexObserve.ValueForViewing("$old_d_x", Old_x); PexObserve.ValueForViewing("$new_d_x", New_x); //PexObserve.ValueForViewing("$Old_ret", Old_Ret); PexObserve.ValueForViewing("$New_ret", New_Ret); PexObserve.ValueForViewing("$old_d_contains_key_x", Old_dContainsKeyX); PexObserve.ValueForViewing("$new_d_contains_key_x", New_dContainsKeyX); Assert.IsTrue(((New_dCount == Old_dCount && New_x == Old_x) && ((((New_Ret && Old_dContainsKeyX) && (((New_x == Old_dCount && Old_x == Old_dCount && Old_x == New_dCount) && New_x == New_dCount) || ((Old_x != Old_dCount && New_x != Old_dCount && Old_x != New_dCount && New_x != New_dCount) && (!(New_x == New_dCount))))) && New_dContainsKeyX) || ((((!(New_Ret)) && (!(Old_dContainsKeyX))) && (((New_x == Old_dCount && Old_x == Old_dCount && Old_x == New_dCount) && New_x == New_dCount) || ((Old_x != Old_dCount && New_x != Old_dCount && Old_x != New_dCount && New_x != New_dCount) && (!(New_x == New_dCount))))) && (!(New_dContainsKeyX)))))); }
public void PUT_ContainsContract([PexAssumeUnderTest] Queue.Queue <int> s1, int x) { int undefinedTop = PexChoose.Value <int>("old_top"); AssumePrecondition.IsTrue(true); int Old_s1Count = s1.Count; int Old_Top = s1.Count > 0 ? s1.Peek() : undefinedTop; //bool Old_s1ContainsX = s1.Contains(x); /*Code */ bool New_Ret = s1.Contains(x); int New_s1Count = s1.Count; int New_Top = s1.Count > 0 ? s1.Peek() : PexChoose.Value <int>("new_top"); //int New_Top = s1.Count > 0 ? s1.Peek() : Old_Top; //bool New_s1ContainsX = s1.Contains(x); PexObserve.ValueForViewing("$old_s1_Count", Old_s1Count); PexObserve.ValueForViewing("$new_s1_Count", New_s1Count); PexObserve.ValueForViewing("$old_s1_Peek", Old_Top); PexObserve.ValueForViewing("$new_s1_Peek", New_Top); PexObserve.ValueForViewing("$new_ret", New_Ret); //PexObserve.ValueForViewing("$old_s1_contains_x", Old_s1ContainsX); //PexObserve.ValueForViewing("$new_s1_contains_x", New_s1ContainsX); Assert.True(((New_s1Count <= Old_s1Count && Old_s1Count <= New_s1Count && (!(New_Ret)) && New_s1Count >= 0) || (New_s1Count <= Old_s1Count && Old_s1Count <= New_s1Count && Old_Top <= New_Top && New_Top <= Old_Top && New_s1Count >= 1))); }
/// Summary /// Time: 3 min 31 sec /// Pattern: Manual output review /// Difficulties with generalization - loss of test oracle public void ToArrayTest([PexAssumeUnderTest] int[] elements) { BinarySearchTree <int> bst = new BinarySearchTree <int>(elements); int[] actual = bst.ToArray(); PexObserve.ValueForViewing <int[]>("BinarySearchTree Output", actual); }
public void SortCyclicPUT_NEW1(AdjacencyGraph g, bool rndConstructor, bool allowParallelEdges, int numberOfVertices, bool toNull) { g = AdjacencyGraphFactory.CreateAcyclicGraph1(allowParallelEdges, numberOfVertices, toNull); TopologicalSortAlgorithm topo; List <IVertex> list = null; if (g != null && g.VerticesCount > 0) { list = new List <IVertex>(); foreach (IVertex v in g.Vertices) { IVertex a = g.AddVertex(); list.Add(v); } g = createCycle(g); } if (rndConstructor) { topo = new TopologicalSortAlgorithm(g, list); } else { topo = new TopologicalSortAlgorithm(g); } topo.Compute(); for (int j = 0; j < topo.SortedVertices.Count; ++j) { PexObserve.ValueForViewing <IVertex>("Sorted Vertex", (IVertex)topo.SortedVertices[j]); } }
public void SortCyclicPUT_NEW(AdjacencyGraph g, IVertex[] listOfVertices, bool rndConstructor) { TopologicalSortAlgorithm topo;// = new TopologicalSortAlgorithm(g); List <IVertex> list = null; if (listOfVertices != null && g != null) { list = new List <IVertex>(); foreach (IVertex v in listOfVertices) { IVertex a = g.AddVertex(); list.Add(v); } g = createCycle(g); } if (rndConstructor) { topo = new TopologicalSortAlgorithm(g, list); } else { topo = new TopologicalSortAlgorithm(g); } topo.Compute(); for (int j = 0; j < topo.SortedVertices.Count; ++j) { PexObserve.ValueForViewing <IVertex>("Sorted Vertex", (IVertex)topo.SortedVertices[j]); } }
public void PUT_LastIndexOfContract([PexAssumeUnderTest] ArrayList arrList, int x) { AssumePrecondition.IsTrue(true); int Old_arrListCount = arrList.Count; int Old_x = x; int Old_arrListIndexOfX = arrList.IndexOf(x); //int Old_arrListLastIndexOfX = arrList.LastIndexOf(x); bool Old_arrListContainsX = arrList.Contains(x); int New_Ret = arrList.LastIndexOf(x); int New_arrListCount = arrList.Count; int New_arrListIndexOfX = arrList.IndexOf(x); //int New_arrListLastIndexOfX = arrList.LastIndexOf(x); bool New_arrListContainsX = arrList.Contains(x); PexObserve.ValueForViewing("$old_arrList_Count", Old_arrListCount); PexObserve.ValueForViewing("$new_arrList_Count", New_arrListCount); PexObserve.ValueForViewing("$old_arrList_x", Old_x); PexObserve.ValueForViewing("$old_arrList_IndexOf_x", Old_arrListIndexOfX); PexObserve.ValueForViewing("$new_arrList_IndexOf_x", New_arrListIndexOfX); //PexObserve.ValueForViewing("$old_arrList_LastIndexOf_x", Old_arrListLastIndexOfX); //PexObserve.ValueForViewing("$new_arrList_LastIndexOf_x", New_arrListLastIndexOfX); PexObserve.ValueForViewing("$New_ret", New_Ret); PexObserve.ValueForViewing("$old_arrList_contains_x", Old_arrListContainsX); PexObserve.ValueForViewing("$new_arrList_contains_x", New_arrListContainsX); Assert.True(((New_arrListCount == Old_arrListCount && New_arrListIndexOfX == Old_arrListIndexOfX && New_arrListIndexOfX != Old_arrListCount && New_Ret != Old_arrListCount && Old_arrListIndexOfX != New_arrListCount && New_arrListIndexOfX != New_arrListCount && New_Ret != New_arrListCount && New_arrListCount <= Old_arrListCount && New_arrListIndexOfX < Old_arrListCount && New_arrListIndexOfX <= Old_arrListCount && New_Ret < Old_arrListCount && New_Ret <= Old_arrListCount && Old_arrListIndexOfX < New_arrListCount && Old_arrListIndexOfX <= New_arrListCount && New_arrListIndexOfX < New_arrListCount && New_arrListIndexOfX <= New_arrListCount && New_Ret < New_arrListCount && New_Ret <= New_arrListCount && New_arrListIndexOfX <= Old_arrListIndexOfX && 0 <= Old_arrListCount && -1 < Old_arrListCount && -1 <= Old_arrListCount && 0 <= New_arrListCount && -1 < New_arrListCount && -1 <= New_arrListCount && -1 <= Old_arrListIndexOfX && -1 <= New_arrListIndexOfX && -1 <= New_Ret) && (((Old_arrListContainsX && 1 <= Old_arrListCount && 0 < Old_arrListCount && 1 <= New_arrListCount && 0 < New_arrListCount && 0 <= Old_arrListIndexOfX && -1 < Old_arrListIndexOfX && 0 <= New_arrListIndexOfX && -1 < New_arrListIndexOfX && 0 <= New_Ret && -1 < New_Ret) && New_arrListContainsX) || ((New_Ret == Old_arrListIndexOfX && (!(Old_arrListContainsX)) && New_Ret == New_arrListIndexOfX && New_Ret <= Old_arrListIndexOfX && New_Ret <= New_arrListIndexOfX && -1 == Old_arrListIndexOfX && -1 == New_arrListIndexOfX && -1 == New_Ret) && (!(New_arrListContainsX)))))); }
public static UndirectedGraph <int, Edge <int> > CreateGraphArrayOfNodesAndEdges([PexAssumeNotNull] int[] nodes, [PexAssumeNotNull] bool[] edges) { PexAssume.IsTrue(edges.Length == nodes.Length); PexAssume.AreDistinctValues(nodes); PexAssume.TrueForAll(nodes, e => e <= 10 || e > 10); PexAssume.TrueForAll(nodes, e => e != 0); UndirectedGraph <int, Edge <int> > g = new UndirectedGraph <int, Edge <int> >(false); foreach (int ele in nodes) { g.AddVertex(ele); } for (int i = 0; i < edges.Length; i++) { int source = PexChoose.IndexValue("indexed value", nodes); PexObserve.ValueForViewing("CANED_SRC", source); if (edges[source] == false) { g.AddEdge(new Edge <int>(nodes[source], nodes[i])); g.AddEdge(new Edge <int>(nodes[i], nodes[i])); } } return(g); }
public void PUT_AddContract([PexAssumeUnderTest] ArrayList arrList, int x) { AssumePrecondition.IsTrue(true); int Old_arrListCount = arrList.Count; int Old_x = x; int Old_arrListIndexOfX = arrList.IndexOf(x); int Old_arrListLastIndexOfX = arrList.LastIndexOf(x); bool Old_arrListContainsX = arrList.Contains(x); int New_Ret = arrList.Add(x); int New_arrListCount = arrList.Count; int New_arrListIndexOfX = arrList.IndexOf(x); int New_arrListLastIndexOfX = arrList.LastIndexOf(x); bool New_arrListContainsX = arrList.Contains(x); //bool New_containsNewRet = arrList.Contains(New_Ret); PexObserve.ValueForViewing("$old_arrList_Count", Old_arrListCount); PexObserve.ValueForViewing("$new_arrList_Count", New_arrListCount); PexObserve.ValueForViewing("$old_arrList_x", Old_x); PexObserve.ValueForViewing("$old_arrList_IndexOf_x", Old_arrListIndexOfX); PexObserve.ValueForViewing("$new_arrList_IndexOf_x", New_arrListIndexOfX); PexObserve.ValueForViewing("$old_arrList_LastIndexOf_x", Old_arrListLastIndexOfX); PexObserve.ValueForViewing("$new_arrList_LastIndexOf_x", New_arrListLastIndexOfX); PexObserve.ValueForViewing("$New_ret", New_Ret); PexObserve.ValueForViewing("$old_arrList_contains_x", Old_arrListContainsX); PexObserve.ValueForViewing("$new_arrList_contains_x", New_arrListContainsX); //PexObserve.ValueForViewing("$new_containsNewRet", New_containsNewRet); Assert.True(((New_arrListContainsX && New_arrListCount == 1 + Old_arrListCount && Old_arrListCount <= New_Ret && (!(New_arrListCount <= New_Ret)) && (!(New_Ret <= Old_arrListLastIndexOfX)) && New_Ret <= New_arrListLastIndexOfX && New_arrListLastIndexOfX <= New_Ret && Old_arrListContainsX && Old_arrListIndexOfX <= Old_arrListLastIndexOfX && New_arrListIndexOfX == Old_arrListIndexOfX && Old_arrListIndexOfX >= 0) || (New_arrListContainsX && New_arrListCount == 1 + Old_arrListCount && (!(New_arrListCount <= New_arrListIndexOfX)) && New_arrListIndexOfX <= New_arrListLastIndexOfX && New_arrListLastIndexOfX <= New_arrListIndexOfX && (!(Old_arrListContainsX)) && Old_arrListCount <= New_arrListIndexOfX && New_Ret == New_arrListIndexOfX && New_arrListIndexOfX >= 0 && Old_arrListIndexOfX == -1 && Old_arrListLastIndexOfX == -1))); }
public void PUT_InsertContract([PexAssumeUnderTest] ArrayList arrList, int x, int index) { AssumePrecondition.IsTrue(index <= arrList.Count && index >= 0); int Old_arrListCount = arrList.Count; int Old_x = x; int Old_index = index; int Old_arrListIndexOfX = arrList.IndexOf(x); int Old_arrListLastIndexOfX = arrList.LastIndexOf(x); bool Old_arrListContainsX = arrList.Contains(x); arrList.Insert(index, x); int New_arrListCount = arrList.Count; int New_arrListIndexOfX = arrList.IndexOf(x); int New_arrListLastIndexOfX = arrList.LastIndexOf(x); bool New_arrListContainsX = arrList.Contains(x); PexObserve.ValueForViewing("$old_arrList_Count", Old_arrListCount); PexObserve.ValueForViewing("$new_arrList_Count", New_arrListCount); PexObserve.ValueForViewing("$old_arrList_x", Old_x); PexObserve.ValueForViewing("$old_arrList_index", Old_index); PexObserve.ValueForViewing("$old_arrList_IndexOf_x", Old_arrListIndexOfX); PexObserve.ValueForViewing("$new_arrList_IndexOf_x", New_arrListIndexOfX); PexObserve.ValueForViewing("$old_arrList_LastIndexOf_x", Old_arrListLastIndexOfX); PexObserve.ValueForViewing("$new_arrList_LastIndexOf_x", New_arrListLastIndexOfX); PexObserve.ValueForViewing("$old_arrList_contains_x", Old_arrListContainsX); PexObserve.ValueForViewing("$new_arrList_contains_x", New_arrListContainsX); Assert.True(((New_arrListContainsX && New_arrListCount == 1 + Old_arrListCount && (!(New_arrListCount <= New_arrListLastIndexOfX)) && New_arrListIndexOfX <= Old_index && Old_index <= New_arrListLastIndexOfX && Old_arrListIndexOfX <= Old_arrListLastIndexOfX && (!(New_arrListLastIndexOfX <= Old_arrListLastIndexOfX)) && Old_arrListIndexOfX >= -1 && New_arrListIndexOfX >= 0))); }
public void PUT_MinimumContract([PexAssumeUnderTest] BinaryHeap.BinaryHeap <int, int> bh) { AssumePrecondition.IsTrue(bh.Count > 0); int Old_bhCount = bh.Count; //int Old_bhCapacity = bh.Capacity; int Old_bhMinimumKey = bh.Minimum().Key; int Old_bhMinimumValue = bh.Minimum().Value; //code var m = bh.Minimum(); int New_Ret_Key = m.Key; int New_Ret_Value = m.Value; int New_bhCount = bh.Count; //int New_bhCapacity = bh.Capacity; int New_bhMinimumKey = bh.Minimum().Key; int New_bhMinimumValue = bh.Minimum().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_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("$new_ret_key", New_Ret_Key); PexObserve.ValueForViewing("$new_ret_value", New_Ret_Value); Assert.True(((Old_bhCount <= New_bhCount && New_bhCount <= Old_bhCount && New_Ret_Key == Old_bhMinimumKey && New_Ret_Value <= Old_bhMinimumValue && New_bhMinimumValue <= New_Ret_Value && New_bhMinimumKey == Old_bhMinimumKey && Old_bhMinimumValue <= New_bhMinimumValue && Old_bhCount >= 1))); }
public void PUT_PushContract([PexAssumeUnderTest] Stack.Stack <int> s1, int x) { AssumePrecondition.IsTrue(true); int Old_s1Count = s1.Count; int Old_Top = s1.Count > 0 ? s1.Peek() : PexChoose.Value <int>("old_top"); //int Old_Top = s1.Count > 0 ? s1.Peek() : x--; //int Old_Top = s1.Peek(); int Old_x = x; bool Old_s1ContainsX = s1.Contains(x); s1.Push(x); int New_s1Count = s1.Count; int New_Top = s1.Peek(); int New_x = x; bool New_s1ContainsX = s1.Contains(x); PexObserve.ValueForViewing("$old_s1_Count", Old_s1Count); PexObserve.ValueForViewing("$new_s1_Count", New_s1Count); PexObserve.ValueForViewing("$old_s1_Peek", Old_Top); PexObserve.ValueForViewing("$new_s1_Peek", New_Top); PexObserve.ValueForViewing("$old_s1_x", Old_x); PexObserve.ValueForViewing("$new_s1_x", New_x); PexObserve.ValueForViewing("$Old_s1ContainsX", Old_s1ContainsX); PexObserve.ValueForViewing("$New_s1ContainsX", New_s1ContainsX); Assert.True(((New_s1ContainsX && New_s1Count == 1 + Old_s1Count && Old_x == New_Top && New_x == New_Top))); }
public void InsertionAndDeletionPUT([PexAssumeUnderTest] List <int> values, int start, int end) { PexAssume.IsFalse(start < 0 || end < 0); PexAssume.IsTrue(start < values.Count); PexAssume.IsTrue(end >= start && end < values.Count); PexAssume.AreDistinctValues <int>(values.ToArray()); AvlTree <int> avlTree = new AvlTree <int>(); foreach (int i in values) { avlTree.Add(i); } PexAssert.AreEqual(values.Count, avlTree.Count); PexObserve.ValueForViewing <int>("Root", avlTree.Root.Value); int toRemoveCount = (end - start) == 0?1:end - start; IList <int> toRemove = values.GetRange(start, toRemoveCount); foreach (int i in toRemove) { avlTree.Remove(i); } PexAssert.AreEqual(values.Count - toRemoveCount, avlTree.Count); IEnumerable enumerator = avlTree.GetInorderEnumerator(); foreach (int i in enumerator) { PexObserve.ValueForViewing <int>("tree nodes", i); } }
public void PUT_PopContract([PexAssumeUnderTest] Stack.Stack <int> s1) { AssumePrecondition.IsTrue(s1.Count > 0); int Old_s1Count = s1.Count; //int Old_Ret = PexChoose.Value<int>("old_ret"); int Old_Top = s1.Peek(); /*code*/ int New_Ret = s1.Pop(); //Old_ret = New_ret; int New_Top = s1.Count > 0 ? s1.Peek() : PexChoose.Value <int>("old_top"); //int New_Top = s1.Count > 0 ? s1.Peek() : Old_Top - 1; int New_s1Count = s1.Count; bool New_ContainsNewRet = s1.Contains(New_Ret); PexObserve.ValueForViewing("$Old_s1_Count", Old_s1Count); PexObserve.ValueForViewing("$New_s1_Count", New_s1Count); PexObserve.ValueForViewing("$Old_s1_Peek", Old_Top); PexObserve.ValueForViewing("$new_s1_Peek", New_Top); //PexObserve.ValueForViewing("$Old_ret", Old_Ret); PexObserve.ValueForViewing("$New_ret", New_Ret); PexObserve.ValueForViewing("$New_ContainsNewRet", New_ContainsNewRet); Assert.True(((New_s1Count == -1 + Old_s1Count && New_Ret == Old_Top))); }
public void PUT_GetContract([PexAssumeUnderTest] Dictionary.Dictionary <int, int> d, int x) { AssumePrecondition.IsTrue(d.ContainsKey(x)); int Old_dCount = d.Count; int Old_x = x; bool Old_dContainsKeyX = d.ContainsKey(x); int New_Ret = d[x]; int New_dCount = d.Count; bool New_dContainsKeyX = d.ContainsKey(x); bool New_ContainsKeyNewRet = d.ContainsKey(New_Ret); bool New_ContainsValueNewRet = d.ContainsValue(New_Ret); PexObserve.ValueForViewing("$old_d_Count", Old_dCount); PexObserve.ValueForViewing("$new_d_Count", New_dCount); PexObserve.ValueForViewing("$old_d_x", Old_x); PexObserve.ValueForViewing("$New_ret", New_Ret); PexObserve.ValueForViewing("$old_d_contains_key_x", Old_dContainsKeyX); PexObserve.ValueForViewing("$new_d_contains_key_x", New_dContainsKeyX); PexObserve.ValueForViewing("$old_d_contains_key_x", New_ContainsKeyNewRet); PexObserve.ValueForViewing("$new_d_contains_key_x", New_ContainsValueNewRet); Assert.True(((New_dCount == Old_dCount && Old_dContainsKeyX && New_dContainsKeyX && New_ContainsValueNewRet && (!(New_Ret == Old_x)) && Old_dCount >= 1) || (New_dCount == Old_dCount && Old_dContainsKeyX && New_dContainsKeyX && New_ContainsValueNewRet && New_ContainsKeyNewRet && Old_dCount >= 1))); }
public void PUT_EnqueueContract([PexAssumeUnderTest] Queue.Queue <int> s1, int x) { AssumePrecondition.IsTrue(true); int Old_s1Count = s1.Count; int Old_Top = s1.Count > 0 ? s1.Peek() : PexChoose.Value <int>("old_top"); //int Old_Top = s1.Count > 0 ? s1.Peek() : x - 1; // OldTop = x; x updates x = x-1 int Old_x = x; bool Old_s1ContainsX = s1.Contains(x); //bool Old_Empty = s1.Count == 0; s1.Enqueue(x); int New_s1Count = s1.Count; int New_Top = s1.Peek(); bool New_s1ContainsX = s1.Contains(x); //bool New_Empty = s1.Count == 0; PexObserve.ValueForViewing("$old_s1_Count", Old_s1Count); PexObserve.ValueForViewing("$new_s1_Count", New_s1Count); PexObserve.ValueForViewing("$old_s1_Peek", Old_Top); PexObserve.ValueForViewing("$new_s1_Peek", New_Top); PexObserve.ValueForViewing("$old_s1_x", Old_x); PexObserve.ValueForViewing("$old_s1_contains_x", Old_s1ContainsX); PexObserve.ValueForViewing("$new_s1_contains_x", New_s1ContainsX); //PexObserve.ValueForViewing("$Old_NotEmpty", Old_Empty); //PexObserve.ValueForViewing("$New_NotEmpty", New_Empty); Assert.True(((New_s1ContainsX && New_s1Count == 1 + Old_s1Count && (!(Old_s1ContainsX)) && New_s1Count >= 1) || (New_s1ContainsX && New_s1Count == 1 + Old_s1Count && New_Top == Old_Top && New_s1Count >= 2))); }
public void ConcatenatePUT(int[] inputArray1, int[] inputArray2, int[] inputArray3) { if (inputArray1 == null || inputArray1 == null || inputArray1 == null) { Sorting.Concatenate(inputArray1, inputArray2, inputArray3); PexAssert.IsTrue(false, "ArgumentNullException was expected"); } PexAssume.AreNotEqual(inputArray1, inputArray2); PexAssume.AreNotEqual(inputArray3, inputArray2); IList <int> result = Sorting.Concatenate(inputArray1, inputArray2, inputArray3); PexAssert.AreEqual(inputArray1.Length + inputArray2.Length + inputArray3.Length, result.Count); int count = 0; for (int i = 0; i < inputArray1.Length; i++) { PexAssert.AreEqual(inputArray1[i], result[count]); count++; } for (int i = 0; i < inputArray2.Length; i++) { PexAssert.AreEqual(inputArray2[i], result[count]); count++; } for (int i = 0; i < inputArray3.Length; i++) { PexAssert.AreEqual(inputArray3[i], result[count]); count++; } PexObserve.ValueForViewing <IList <int> >("Concatenate Output", result); }
public void PUT_IndexOfContract([PexAssumeUnderTest] BinaryHeap.BinaryHeap <int, int> bh, 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_value = value; //code int New_Ret = bh.IndexOf(value); int New_bhCount = bh.Count; int New_bhCapacity = bh.Capacity; 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_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_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_value", Old_value); PexObserve.ValueForViewing("$new_bh_value", New_value); PexObserve.ValueForViewing("$new_ret", New_Ret); Assert.IsTrue(false); }
public void PUT_EnqueueContract([PexAssumeUnderTest] Queue.Queue <int> s1, int x) { AssumePrecondition.IsTrue(true); int Old_s1Count = s1.Count; int Old_Top = s1.Count > 0 ? s1.Peek() : PexChoose.Value <int>("old_top"); //int Old_Top = s1.Count > 0 ? s1.Peek() : x+1; //int Old_Top = PexChoose.Value<int>("old_top"); int Old_x = x; bool Old_s1ContainsX = s1.Contains(x); s1.Enqueue(x); int New_s1Count = s1.Count; int New_Top = s1.Peek(); int New_x = x; bool New_s1ContainsX = s1.Contains(x); PexObserve.ValueForViewing("$old_s1_Count", Old_s1Count); PexObserve.ValueForViewing("$new_s1_Count", New_s1Count); PexObserve.ValueForViewing("$old_s1_Peek", Old_Top); PexObserve.ValueForViewing("$new_s1_Peek", New_Top); PexObserve.ValueForViewing("$old_s1_x", Old_x); PexObserve.ValueForViewing("$new_s1_x", New_x); PexObserve.ValueForViewing("$old_s1_contains_x", Old_s1ContainsX); PexObserve.ValueForViewing("$new_s1_contains_x", New_s1ContainsX); Assert.True(((New_s1ContainsX && New_s1Count == 1 + Old_s1Count && New_x == Old_x && (!(Old_Top == New_s1Count))))); }
public void PUT_SetContract([PexAssumeUnderTest] Dictionary.Dictionary <int, int> d, int x, int y) { AssumePrecondition.IsTrue(true); int Old_dCount = d.Count; int Old_x = x; int Old_y = y; bool Old_dContainsKeyX = d.ContainsKey(x); bool Old_dContainsValueY = d.ContainsValue(y); d[x] = y; int New_dCount = d.Count; int New_x = x; int New_y = y; bool New_dContainsKeyX = d.ContainsKey(x); bool New_dContainsValueY = d.ContainsValue(y); PexObserve.ValueForViewing("$old_d_Count", Old_dCount); PexObserve.ValueForViewing("$new_d_Count", New_dCount); PexObserve.ValueForViewing("$old_d_x", Old_x); PexObserve.ValueForViewing("$new_d_x", New_x); PexObserve.ValueForViewing("$old_d_y", Old_y); PexObserve.ValueForViewing("$new_d_y", New_y); PexObserve.ValueForViewing("$old_d_contains_key_x", Old_dContainsKeyX); PexObserve.ValueForViewing("$new_d_contains_key_x", New_dContainsKeyX); PexObserve.ValueForViewing("$old_d_contains_value_y", Old_dContainsValueY); PexObserve.ValueForViewing("$new_d_contains_value_y", New_dContainsValueY); Assert.IsTrue(((New_dContainsKeyX && New_dContainsValueY && New_x == Old_x && New_y == Old_y) && ((((New_dCount == Old_dCount) && (((New_y == Old_x && Old_y == Old_x && Old_y == New_x) && New_y == New_x) || ((Old_y != Old_x && New_y != Old_x && Old_y != New_x && New_y != New_x) && (!(New_y == New_x))))) && Old_dContainsKeyX) || (((New_dCount == Old_dCount + 1 && New_dCount != Old_dCount) && (((Old_y == Old_dCount && Old_y != New_dCount && New_y != New_dCount) && New_y == Old_dCount) || ((Old_y != Old_dCount && New_y != Old_dCount) && (!(New_y == Old_dCount))))) && (!(Old_dContainsKeyX)))))); }
/// Summary /// Time: 6 min 35 sec /// Pattern: Manual output review /// Difficulties: Issue with PUTs where we cannot write test oracles public void GetEnumeratorTest([PexAssumeUnderTest] List <int> elemList) { PriorityQueue <int> actual = new PriorityQueue <int>(elemList, Strategy.Max); PexObserve.ValueForViewing <int[]>("Actual", actual.ToArray()); //CollectionAssert.AreEqual(elemList.ToArray(), actual.ToArray()); }
public void PUT_ContainsValueContract([PexAssumeUnderTest] Dictionary.Dictionary <int, int> d, int y) { AssumePrecondition.IsTrue(true); int Old_dCount = d.Count; int Old_y = y; //bool Old_Ret = PexChoose.Value<bool>("default_Ret"); bool Old_dContainsValueY = d.ContainsValue(y); bool New_Ret = d.ContainsValue(y); int New_dCount = d.Count; int New_y = y; bool New_dContainsValueY = d.ContainsValue(y); PexObserve.ValueForViewing("$old_d_Count", Old_dCount); PexObserve.ValueForViewing("$new_d_Count", New_dCount); PexObserve.ValueForViewing("$old_d_y", Old_y); PexObserve.ValueForViewing("$new_d_y", New_y); //PexObserve.ValueForViewing("$Old_ret", Old_Ret); PexObserve.ValueForViewing("$New_ret", New_Ret); PexObserve.ValueForViewing("$old_d_contains_value_y", Old_dContainsValueY); PexObserve.ValueForViewing("$new_d_contains_value_y", New_dContainsValueY); Assert.IsTrue(((New_dCount == Old_dCount && New_y == Old_y) && ((((New_Ret && Old_dContainsValueY) && (((New_y == Old_dCount && Old_y == Old_dCount && Old_y == New_dCount) && New_y == New_dCount) || ((Old_y != Old_dCount && New_y != Old_dCount && Old_y != New_dCount && New_y != New_dCount) && (!(New_y == New_dCount))))) && New_dContainsValueY) || ((((!(New_Ret)) && (!(Old_dContainsValueY))) && (((New_y == Old_dCount && Old_y == Old_dCount && Old_y == New_dCount) && New_y == New_dCount) || ((Old_y != Old_dCount && New_y != Old_dCount && Old_y != New_dCount && New_y != New_dCount) && (!(New_y == New_dCount))))) && (!(New_dContainsValueY)))))); }
public void PUT_EdgeCountContract([PexAssumeUnderTest] UndirectedGraph.UndirectedGraph <int, Edge <int> > ug) { AssumePrecondition.IsTrue(true); int Old_ugVertexCount = ug.VertexCount; int Old_ugEdgeCount = ug.EdgeCount; int Old_Ret = PexChoose.Value <int>("old_Ret"); bool Old_ugAllowParallelEdges = ug.AllowParallelEdges; //code int New_Ret = ug.EdgeCount; int New_ugVertexCount = ug.VertexCount; int New_ugEdgeCount = ug.EdgeCount; bool New_ugAllowParallelEdges = ug.AllowParallelEdges; PexObserve.ValueForViewing("$old_ug_vertex_count", Old_ugVertexCount); PexObserve.ValueForViewing("$new_ug_vertex_count", New_ugVertexCount); PexObserve.ValueForViewing("$old_ug_edge_count", Old_ugEdgeCount); PexObserve.ValueForViewing("$new_ug_edge_count", New_ugEdgeCount); PexObserve.ValueForViewing("$old_ret", Old_Ret); PexObserve.ValueForViewing("$new_ret", New_Ret); PexObserve.ValueForViewing("$old_ug_allow_parallel_edges", Old_ugAllowParallelEdges); PexObserve.ValueForViewing("$new_ug_allow_parallel_edges", New_ugAllowParallelEdges); PexAssert.IsTrue(false); }
public void PUT_SetContract([PexAssumeUnderTest] ArrayList arrList, int x, int index) { AssumePrecondition.IsTrue(index < arrList.Count && index >= 0); int Old_arrListCount = arrList.Count; int Old_x = x; int Old_index = index; int Old_arrListIndexOfX = arrList.IndexOf(x); int Old_arrListLastIndexOfX = arrList.LastIndexOf(x); bool Old_arrListContainsX = arrList.Contains(x); arrList[index] = x; int New_arrListCount = arrList.Count; int New_x = x; int New_index = index; int New_arrListIndexOfX = arrList.IndexOf(x); int New_arrListLastIndexOfX = arrList.LastIndexOf(x); bool New_arrListContainsX = arrList.Contains(x); PexObserve.ValueForViewing("$old_arrList_Count", Old_arrListCount); PexObserve.ValueForViewing("$new_arrList_Count", New_arrListCount); PexObserve.ValueForViewing("$old_arrList_x", Old_x); PexObserve.ValueForViewing("$new_arrList_x", New_x); PexObserve.ValueForViewing("$old_arrList_index", Old_index); PexObserve.ValueForViewing("$new_arrList_index", New_index); PexObserve.ValueForViewing("$old_arrList_IndexOf_x", Old_arrListIndexOfX); PexObserve.ValueForViewing("$new_arrList_IndexOf_x", New_arrListIndexOfX); PexObserve.ValueForViewing("$old_arrList_LastIndexOf_x", Old_arrListLastIndexOfX); PexObserve.ValueForViewing("$new_arrList_LastIndexOf_x", New_arrListLastIndexOfX); PexObserve.ValueForViewing("$old_arrList_contains_x", Old_arrListContainsX); PexObserve.ValueForViewing("$new_arrList_contains_x", New_arrListContainsX); Assert.True(((New_arrListContainsX && New_arrListCount == Old_arrListCount && New_x == Old_x && New_index == Old_index && Old_index != Old_arrListCount && New_index != Old_arrListCount && Old_arrListIndexOfX != Old_arrListCount && New_arrListIndexOfX != Old_arrListCount && Old_arrListLastIndexOfX != Old_arrListCount && New_arrListLastIndexOfX != Old_arrListCount && Old_index != New_arrListCount && New_index != New_arrListCount && Old_arrListIndexOfX != New_arrListCount && New_arrListIndexOfX != New_arrListCount && Old_arrListLastIndexOfX != New_arrListCount && New_arrListLastIndexOfX != New_arrListCount) && ((((Old_arrListContainsX && New_arrListLastIndexOfX == Old_arrListCount - 1) && (((New_x == 0 && New_index == 0 && New_arrListIndexOfX == 0 && New_arrListLastIndexOfX == Old_arrListLastIndexOfX && Old_x != Old_arrListCount && New_x != Old_arrListCount && Old_x != New_arrListCount && New_x != New_arrListCount && Old_index == Old_x && New_index == Old_x && Old_arrListIndexOfX == Old_x && New_arrListIndexOfX == Old_x && Old_index == New_x && Old_arrListIndexOfX == New_x && New_arrListIndexOfX == New_x && Old_arrListIndexOfX == Old_index && New_arrListIndexOfX == Old_index && Old_arrListIndexOfX == New_index && New_arrListIndexOfX == New_index) && New_index == New_x) || ((Old_index != Old_x && New_index != Old_x && Old_index != New_x && New_index != New_x) && (!(New_index == New_x))))) && New_arrListIndexOfX == Old_arrListIndexOfX) || (((New_arrListIndexOfX == Old_index && Old_arrListIndexOfX != Old_index && Old_arrListLastIndexOfX != Old_index && Old_arrListIndexOfX != New_index && New_arrListIndexOfX == New_index && Old_arrListLastIndexOfX != New_index && New_arrListIndexOfX != Old_arrListIndexOfX && Old_arrListLastIndexOfX != New_arrListIndexOfX) && (((New_x == Old_arrListCount && New_arrListLastIndexOfX == Old_index && (!(Old_arrListContainsX)) && Old_x == Old_arrListCount && Old_x == New_arrListCount && Old_index != Old_x && New_index != Old_x && Old_arrListIndexOfX != Old_x && New_arrListIndexOfX != Old_x && Old_arrListLastIndexOfX != Old_x && New_arrListLastIndexOfX != Old_x && Old_index != New_x && New_index != New_x && Old_arrListIndexOfX != New_x && New_arrListIndexOfX != New_x && Old_arrListLastIndexOfX != New_x && New_arrListLastIndexOfX != New_x && New_arrListLastIndexOfX == New_index && Old_arrListLastIndexOfX == Old_arrListIndexOfX && New_arrListLastIndexOfX != Old_arrListIndexOfX && New_arrListLastIndexOfX == New_arrListIndexOfX && New_arrListLastIndexOfX != Old_arrListLastIndexOfX) && New_x == New_arrListCount) || ((Old_x != Old_arrListCount && New_x != Old_arrListCount && Old_x != New_arrListCount && New_x != New_arrListCount) && (!(New_x == New_arrListCount))))) && (!(New_arrListIndexOfX == Old_arrListIndexOfX)))))); }
public void PUT_ContainsContract([PexAssumeUnderTest] Stack.Stack <int> s1, int x) { int undefinedTop = PexChoose.Value <int>("old_top"); AssumePrecondition.IsTrue(true); int Old_s1Count = s1.Count; int Old_Top = s1.Count > 0 ? s1.Peek() : undefinedTop; //bool Old_Ret = PexChoose.Value<bool>("default_Ret"); bool Old_s1ContainsX = s1.Contains(x); /*Code */ bool New_Ret = s1.Contains(x); int New_s1Count = s1.Count; //int New_Top = s1.Count > 0 ? s1.Peek() : undefinedTop; int New_Top = s1.Count > 0 ? s1.Peek() : PexChoose.Value <int>("new_top"); bool New_s1ContainsX = s1.Contains(x); PexObserve.ValueForViewing("$old_s1_Count", Old_s1Count); PexObserve.ValueForViewing("$new_s1_Count", New_s1Count); PexObserve.ValueForViewing("$old_s1_Peek", Old_Top); PexObserve.ValueForViewing("$new_s1_Peek", New_Top); //PexObserve.ValueForViewing("$old_s1_ret", Old_Ret); PexObserve.ValueForViewing("$new_ret", New_Ret); PexObserve.ValueForViewing("$old_s1_contains_x", Old_s1ContainsX); PexObserve.ValueForViewing("$new_s1_contains_x", New_s1ContainsX); Assert.True(((New_s1Count == Old_s1Count))); }
public void PUT_RemoveContract([PexAssumeUnderTest] ArrayList arrList, int x) { AssumePrecondition.IsTrue(true); int Old_arrListCount = arrList.Count; int Old_x = x; int Old_arrListIndexOfX = arrList.IndexOf(x); int Old_arrListLastIndexOfX = arrList.LastIndexOf(x); bool Old_arrListContainsX = arrList.Contains(x); arrList.Remove(x); int New_arrListCount = arrList.Count; int New_x = x; int New_arrListIndexOfX = arrList.IndexOf(x); int New_arrListLastIndexOfX = arrList.LastIndexOf(x); bool New_arrListContainsX = arrList.Contains(x); PexObserve.ValueForViewing("$old_arrList_Count", Old_arrListCount); PexObserve.ValueForViewing("$new_arrList_Count", New_arrListCount); PexObserve.ValueForViewing("$old_arrList_x", Old_x); PexObserve.ValueForViewing("$new_arrList_x", New_x); PexObserve.ValueForViewing("$old_arrList_IndexOf_x", Old_arrListIndexOfX); PexObserve.ValueForViewing("$new_arrList_IndexOf_x", New_arrListIndexOfX); PexObserve.ValueForViewing("$old_arrList_LastIndexOf_x", Old_arrListLastIndexOfX); PexObserve.ValueForViewing("$new_arrList_LastIndexOf_x", New_arrListLastIndexOfX); PexObserve.ValueForViewing("$old_arrList_contains_x", Old_arrListContainsX); PexObserve.ValueForViewing("$new_arrList_contains_x", New_arrListContainsX); Assert.True(((New_x == Old_x && Old_arrListIndexOfX != Old_arrListCount && New_arrListIndexOfX != Old_arrListCount && Old_arrListLastIndexOfX != Old_arrListCount && New_arrListLastIndexOfX != Old_arrListCount && New_arrListIndexOfX != New_arrListCount && New_arrListLastIndexOfX != New_arrListCount) && ((((New_arrListCount == Old_arrListIndexOfX + Old_arrListCount - Old_arrListLastIndexOfX && New_arrListIndexOfX == Old_arrListIndexOfX && Old_arrListIndexOfX != New_arrListCount && New_arrListLastIndexOfX == New_arrListIndexOfX) && (((New_arrListCount == Old_x && Old_x == New_arrListCount && Old_arrListIndexOfX != Old_x && New_arrListIndexOfX != Old_x && New_arrListLastIndexOfX != Old_x && Old_arrListIndexOfX != New_x && New_arrListIndexOfX != New_x && New_arrListLastIndexOfX != New_x) && New_x == New_arrListCount) || ((Old_x != New_arrListCount && New_x != New_arrListCount) && (!(New_x == New_arrListCount))))) && New_arrListLastIndexOfX == Old_arrListIndexOfX) || (((Old_arrListContainsX && New_arrListCount == Old_arrListCount - 1 && New_arrListCount != Old_arrListCount && New_arrListLastIndexOfX != Old_arrListIndexOfX && Old_arrListLastIndexOfX != New_arrListIndexOfX && New_arrListLastIndexOfX != Old_arrListLastIndexOfX) && (((Old_x != Old_arrListCount && New_x != Old_arrListCount && Old_arrListIndexOfX == Old_x && New_arrListLastIndexOfX != Old_x && New_arrListLastIndexOfX != New_x) && Old_arrListIndexOfX == New_x) || ((Old_arrListIndexOfX != Old_x && Old_arrListIndexOfX != New_x) && (!(Old_arrListIndexOfX == New_x))))) && (!(New_arrListLastIndexOfX == Old_arrListIndexOfX)))))); }
public void GetEnumeratorPUT(int[] values) { DoublyLinkedList <int> dll = new DoublyLinkedList <int>(values); PexAssert.IsNotNull(dll.GetEnumerator()); PexObserve.ValueForViewing <DoublyLinkedList <int> >("Enumeration", dll); }