예제 #1
0
        public void Test_Sub_1()
        {
            var x     = new Var('x');
            var y     = new Var('y');
            var point = new Point(x, y);
            var ps    = new PointSymbol(point);
            var goal1 = new EqGoal(x, -3);
            var goal2 = new EqGoal(y, -4);

            ps.Reify(goal1);
            ps.Reify(goal2);
            Assert.True(ps.CachedGoals.Count == 2);
            Assert.True(ps.CachedSymbols.Count == 1);
        }
예제 #2
0
        public void Test_Unreify_00()
        {
            //true positive
            var  x      = new Var('x');
            var  y      = new Var('y');
            var  point  = new Point(x, y);
            var  ps     = new PointSymbol(point);
            var  eqGoal = new EqGoal(x, 1); // x=1
            bool result = ps.Reify(eqGoal);

            Assert.True(result);
            Assert.False(point.Concrete);
            Assert.True(ps.CachedGoals.Count == 1);
            Assert.True(ps.CachedSymbols.Count == 1);

            var eqGoal2 = new EqGoal(y, 2); // y=2

            result = ps.Reify(eqGoal2);
            Assert.True(result);
            Assert.False(point.Concrete);
            Assert.True(ps.CachedGoals.Count == 2);
            Assert.True(ps.CachedSymbols.Count == 1);

            result = ps.UnReify(eqGoal); // undo x=1
            Assert.True(result);
            Assert.False(point.Concrete);
            Assert.True(ps.CachedGoals.Count == 1);
            Assert.True(ps.CachedSymbols.Count == 1);
            var gps = ps.CachedSymbols.ToList()[0] as PointSymbol;

            Assert.NotNull(gps);
            var gPoint = gps.Shape as Point;

            Assert.NotNull(gPoint);
            Assert.True(gPoint.XCoordinate.Equals(x));
            Assert.True(gPoint.YCoordinate.Equals(2));

            result = ps.UnReify(eqGoal2); // undo y = 2
            Assert.True(result);
            Assert.False(point.Concrete);
            Assert.True(ps.CachedGoals.Count == 0);
            Assert.True(ps.CachedSymbols.Count == 0);
        }
예제 #3
0
        public void Test_reify_1()
        {
            var  x      = new Var('x');
            var  y      = new Var('y');
            var  point  = new Point(x, y);
            var  ps     = new PointSymbol(point);
            var  t      = new Var('t');
            var  eqGoal = new EqGoal(t, 1); // t=1
            bool result = ps.Reify(eqGoal);

            Assert.False(result);
        }
예제 #4
0
        public void Test_Unreify_0()
        {
            //true positive
            var  x      = new Var('x');
            var  y      = new Var('y');
            var  point  = new Point(x, y);
            var  ps     = new PointSymbol(point);
            var  eqGoal = new EqGoal(x, 1); // x=1
            bool result = ps.Reify(eqGoal);

            result = ps.UnReify(eqGoal);
            Assert.True(result);
            Assert.False(point.Concrete);
            Assert.True(ps.CachedGoals.Count == 0);
            Assert.True(ps.CachedSymbols.Count == 0);
        }