public void Test_Update02() { int[] ints2 = new int[1]; int[] ints3 = new int[1]; this.Test_Update (ints2, ints3, 1, 0, PexChoose.CreateDelegate <Func <int, Optional <int> > >()); }
public void Test_Update01() { int[] ints = new int[0]; int[] ints1 = new int[0]; this.Test_Update (ints, ints1, 1, 0, PexChoose.CreateDelegate <Func <int, Optional <int> > >()); }
public static UndirectedGraph <int, Edge <int> > CreateGraphArrayOfNodesAndEdgesAssume([PexAssumeNotNull] int[] nodes, [PexAssumeNotNull] bool[] edges) { //PexAssume.IsTrue(nodes.Length <= 7 || nodes.Length > 7); PexAssume.IsTrue(edges.Length <= 6 || nodes.Length > 6); PexAssume.IsTrue(edges.Length <= nodes.Length); PexAssume.AreDistinctValues(nodes); //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); } int source = PexChoose.IndexValue("indexed value", nodes); for (int i = 0; i < edges.Length; i++) { if (edges[i] == false) { g.AddEdge(new Edge <int>(nodes[source], nodes[i])); } } return(g); }
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_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_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_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 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_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_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_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))); }
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 Test_Map03() { int[] ints4 = new int[2]; int[] ints5 = new int[2]; ints4[0] = 1; this.Test_Map(ints4, ints5, PexChoose.CreateDelegate <Func <int, int, int> >()); }
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 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 CaptureTest50503() { string s; s = this.CaptureTest(PexChoose.CreateDelegate <Action>()); PexAssert.AreEqual <string>("", s); }
public void Test_Map07() { int[] ints12 = new int[3]; int[] ints13 = new int[3]; ints12[0] = 1; ints12[1] = 1073741824; this.Test_Map(ints12, ints13, PexChoose.CreateDelegate <Func <int, int, int> >()); }
public void Test_Update04() { int[] ints6 = new int[1]; int[] ints7 = new int[1]; ints6[0] = 1; this.Test_Update (ints6, ints7, 1, 0, PexChoose.CreateDelegate <Func <int, Optional <int> > >()); }
public void Test_MapPartial01() { int[] ints = new int[1]; int[] ints1 = new int[1]; ints[0] = 1; this.Test_MapPartial (ints, ints1, 0, PexChoose.CreateDelegate <Func <int, int, Optional <int> > >()); }
public void Test_Map04() { int[] ints6 = new int[2]; int[] ints7 = new int[2]; ints6[0] = 1; ints6[1] = 1073741824; this.Test_Map(ints6, ints7, PexChoose.CreateDelegate <Func <int, int, int> >()); }
public void Test_Update05() { int[] ints8 = new int[2]; int[] ints9 = new int[2]; ints8[0] = 1; this.Test_Update (ints8, ints9, 1, 0, PexChoose.CreateDelegate <Func <int, Optional <int> > >()); }
public void Test_Update03() { int[] ints4 = new int[1]; int[] ints5 = new int[1]; ints4[0] = 2; this.Test_Update (ints4, ints5, 1, 0, PexChoose.CreateDelegate <Func <int, Optional <int> > >()); }
public void Test_Map12() { int[] ints22 = new int[4]; int[] ints23 = new int[4]; ints22[0] = 8388609; ints22[2] = 25165824; ints22[3] = 1; this.Test_Map(ints22, ints23, PexChoose.CreateDelegate <Func <int, int, int> >()); }
protected internal override SyntaxTreeNode Visit(TextNode node) { if (!PexChoose.Value <bool>("x")) { return(base.Visit(node)); } return(new TextNode(node.Text, node.HtmlTemplate)); }
public void Test_Update06() { int[] ints10 = new int[3]; int[] ints11 = new int[3]; ints10[0] = 1; ints10[1] = 1073741824; this.Test_Update (ints10, ints11, 1, 0, PexChoose.CreateDelegate <Func <int, Optional <int> > >()); }
public void Test_Map02() { IPexChoiceRecorder choices = PexChoose.NewTest(); int[] ints2 = new int[1]; int[] ints3 = new int[1]; ints3[0] = 1; this.Test_Map(ints2, ints3, PexChoose.CreateDelegate <Func <int, int, int> >()); }
public void Test_Map08() { int[] ints14 = new int[3]; int[] ints15 = new int[3]; ints14[0] = 134217729; ints14[1] = 1; ints14[2] = 134217728; this.Test_Map(ints14, ints15, PexChoose.CreateDelegate <Func <int, int, int> >()); }
public void Test_Map09() { int[] ints16 = new int[4]; int[] ints17 = new int[4]; ints16[0] = 134217729; ints16[1] = 1; ints16[2] = 134217728; this.Test_Map(ints16, ints17, PexChoose.CreateDelegate <Func <int, int, int> >()); }
public void Test_Map10() { int[] ints18 = new int[4]; int[] ints19 = new int[4]; ints18[0] = 1191182337; ints18[2] = 1124106240; ints18[3] = 50364417; this.Test_Map(ints18, ints19, PexChoose.CreateDelegate <Func <int, int, int> >()); }
public void Test_MapPartial02() { int[] ints2 = new int[2]; int[] ints3 = new int[2]; ints2[0] = 1; ints2[1] = 1073741824; this.Test_MapPartial (ints2, ints3, 0, PexChoose.CreateDelegate <Func <int, int, Optional <int> > >()); }