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); }
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); }