public void Test1()
 {
     var pt = new Point(1.0, 2.0);
     var pt2 = new Point(2.0, 4.0);
     var lineSeg = new LineSegment(pt, pt2);
    // Assert.True(lineSeg.RelationStatus);
     Assert.NotNull(lineSeg.Label);
 }
 public static LineSegmentSymbol GenerateLineSegment(Point pt1, Point pt2)
 {
     if (pt1.Equals(pt2)) return null;
     Debug.Assert(pt1.Concrete);
     Debug.Assert(pt2.Concrete);
     var ls  = new LineSegment(pt1, pt2);
     var lss = new LineSegmentSymbol(ls);
     if(pt1.Traces.Count != 0) lss.Traces.AddRange(pt1.Traces);
     if(pt2.Traces.Count != 0) lss.Traces.AddRange(pt2.Traces);
     TraceInstructionalDesign.FromPointsToLineSegment(lss);
     return lss;
 }
 public void Test2()
 {
     var pt1 = new Point(1.0, 2.0);
     var pt2 = new Point(1.0, 2.0);
     try
     {
         var lineSeg = new LineSegment(pt1, pt2);
         Assert.Null(lineSeg);
     }
     catch (Exception)
     {
         Assert.IsTrue(true);
     }
 }
示例#4
0
 private LineSegmentSymbol MockSegment()
 {
     var pt1 = new Point("A", 2, 0);
     var pt2 = new Point("B", 5, 4);
     var seg = new LineSegment("AB", pt1, pt2);
     var segSymbol = new LineSegmentSymbol(seg);
     return segSymbol;
 }
        public void Test_Unify()
        {
            var x = new Var("x");
            var pt1 = new Point(x, 2.0);
            var pt2 = new Point(3.0, 5.0);
            var ls = new LineSegment(pt1, pt2);
            var lss = new LineSegmentSymbol(ls);

            var d = new Var("d");
            var eqGoal = new EqGoal(d, 5); 
          
            object obj;
            bool result = lss.UnifyProperty(eqGoal, out obj);
            Assert.True(result);

            var lst = obj as List<object>;
            Assert.NotNull(lst);
            Assert.True(lst.Count == 2);
            var gGoal1 = lst[0] as EqGoal;
            Assert.NotNull(gGoal1);
            Assert.True(gGoal1.Lhs.ToString().Equals("x"));
            Assert.True(gGoal1.Rhs.ToString().Equals("7"));
            Assert.True(gGoal1.Traces.Count == 3);

            var gGoal2 = lst[1] as EqGoal;
            Assert.NotNull(gGoal2);
            Assert.True(gGoal2.Lhs.ToString().Equals("x"));
            Assert.True(gGoal2.Rhs.ToString().Equals("-1"));
           // Assert.True(gGoal2.Traces.Count == 1);
        }    
示例#6
0
 public LineSegmentSymbol(LineSegment _seg) : base(_seg)
 {
 }