Package edu.cmu.cs.fusion.constraint.predicates

Examples of edu.cmu.cs.fusion.constraint.predicates.ReferenceEqualityPredicate


  }
 
  @Test
  public void testFreeVars() {
    FreeVars fv;
    ReferenceEqualityPredicate pred;
   
    pred = new ReferenceEqualityPredicate(utils.getVar(0), utils.getVar(1));
    fv = pred.getFreeVariables();
 
    assertEquals(FreeVars.OBJECT_TYPE, fv.getType(utils.getVar(0)));
    assertEquals(FreeVars.OBJECT_TYPE, fv.getType(utils.getVar(1)));
   
    assertEquals(2, fv.size());
View Full Code Here


    assertEquals(2, fv.size());
  }
 
  @Test
  public void testTruthFalse() {
    ReferenceEqualityPredicate pred = new ReferenceEqualityPredicate(utils.getVar(0), utils.getVar(1));
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), null);
   
    assertEquals(ThreeValue.FALSE, pred.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    assertEquals(ThreeValue.FALSE, pred.getTruth(env, utils.getSub(0)));
  }

  @Test
  public void testTruthTrue() {
    ReferenceEqualityPredicate pred = new ReferenceEqualityPredicate(utils.getVar(1), utils.getVar(3));
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), null);
   
    assertEquals(ThreeValue.TRUE, pred.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    assertEquals(ThreeValue.TRUE, pred.getTruth(env, utils.getSub(0)));
  }

  @Test
  public void testTruthNotFalse() {
    ReferenceEqualityPredicate pred = new ReferenceEqualityPredicate(utils.getVar(0), utils.getVar(1));
    pred.setPositive(false);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), null);
   
    assertEquals(ThreeValue.TRUE, pred.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    assertEquals(ThreeValue.TRUE, pred.getTruth(env, utils.getSub(0)));
  }

  @Test
  public void testTruthNotTrue() {
    ReferenceEqualityPredicate pred = new ReferenceEqualityPredicate(utils.getVar(1), utils.getVar(3));
    pred.setPositive(false);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), null);
   
    assertEquals(ThreeValue.FALSE, pred.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a RefEquality, but is " + pred.getClass().getCanonicalName(), pred instanceof ReferenceEqualityPredicate);
   
    ReferenceEqualityPredicate val = (ReferenceEqualityPredicate)pred;
    Assert.assertTrue("Parsed predicate should be positive", val.isPositive());
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain two free variable", 2, vars.size());
    Assert.assertEquals("Foo should have a Object type", "java.lang.Object", vars.getType(new SpecVar("foo")));   
    Assert.assertEquals("Bar should have a Object type", "java.lang.Object", vars.getType(new SpecVar("bar")));   
  }
View Full Code Here

    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a RefEquality, but is " + pred.getClass().getCanonicalName(), pred instanceof ReferenceEqualityPredicate);
   
    ReferenceEqualityPredicate val = (ReferenceEqualityPredicate)pred;
    Assert.assertTrue("Parsed predicate should be negative", !val.isPositive());
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain two free variable", 2, vars.size());
    Assert.assertEquals("Foo should have a Object type", "java.lang.Object", vars.getType(new SpecVar("foo")));   
    Assert.assertEquals("Bar should have a Object type", "java.lang.Object", vars.getType(new SpecVar("bar")));   
  }
View Full Code Here

TOP

Related Classes of edu.cmu.cs.fusion.constraint.predicates.ReferenceEqualityPredicate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.