Package edu.cmu.cs.fusion.constraint

Examples of edu.cmu.cs.fusion.constraint.FreeVars


    utils = new TestUtils();
  }
 
  @Test
  public void testFreeVars() {
    FreeVars fv;
    String[] types = utils.getRelation(0).getFullyQualifiedTypes();
   
    RelationshipPredicate lP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(2)});
    RelationshipPredicate rP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    OrPredicate pred = new OrPredicate(lP, rP);
    fv = pred.getFreeVariables();
 
    assertEquals(types[0], fv.getType(utils.getVar(0)));
    assertEquals(types[1], fv.getType(utils.getVar(1)));
    assertEquals(types[1], fv.getType(utils.getVar(2)));
   
    assertEquals(3, fv.size());
  }
View Full Code Here


    Assert.assertTrue("Parsed predicate should be a BooleanValue, but is " + pred.getClass().getCanonicalName(), pred instanceof BooleanValue);
   
    BooleanValue val = (BooleanValue)pred;
    Assert.assertTrue("Parsed predicate should be positive", val.isPositive());
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain one free variable", 1, vars.size());
    Assert.assertEquals("Foo should have a boolean type", "boolean", vars.getType(new SpecVar("foo")));
  }
View Full Code Here

    Assert.assertTrue("Parsed predicate should be a BooleanValue, but is " + pred.getClass().getCanonicalName(), pred instanceof BooleanValue);
   
    BooleanValue val = (BooleanValue)pred;
    Assert.assertTrue("Parsed predicate should be negative", !val.isPositive());
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain one free variable", 1, vars.size());
    Assert.assertEquals("Foo should have a boolean type", "boolean", vars.getType(new SpecVar("foo")));
  }
View Full Code Here

    utils = new TestUtils();
  }
 
  @Test
  public void testFreeVars() {
    FreeVars fv;
    String[] types = utils.getRelation(0).getFullyQualifiedTypes();
   
    RelationshipPredicate lP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(2)});
    RelationshipPredicate rP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    ImpliesPredicate pred = new ImpliesPredicate(lP, rP);
    fv = pred.getFreeVariables();
 
    assertEquals(types[0], fv.getType(utils.getVar(0)));
    assertEquals(types[1], fv.getType(utils.getVar(1)));
    assertEquals(types[1], fv.getType(utils.getVar(2)));
   
    assertEquals(3, fv.size());
  }
View Full Code Here

    TestPredicate val = (TestPredicate)pred;
    Assert.assertTrue("Parsed predicate should be positive", val.isPositive());
    Assert.assertTrue("Parsed inner predicate should be positive", val.getRelationship().isPositive());
    Assert.assertEquals("Inner relationship incorrect", "Foo", val.getRelationship().getRelation().getName());
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain three free variables", 3, vars.size());
    Assert.assertEquals("c should have a boolean type", "boolean", vars.getType(new SpecVar("c")));   
    Assert.assertEquals("a should have a Bar type", "Bar", vars.getType(new SpecVar("a")));   
    Assert.assertEquals("b should have a Baz type", "Baz", vars.getType(new SpecVar("b")));   
  }
View Full Code Here

    TestPredicate val = (TestPredicate)pred;
    Assert.assertTrue("Parsed predicate should be negative", !val.isPositive());
    Assert.assertTrue("Parsed inner predicate should be positive", val.getRelationship().isPositive());
    Assert.assertEquals("Inner relationship incorrect", "Foo", val.getRelationship().getRelation().getName());
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain three free variables", 3, vars.size());
    Assert.assertEquals("c should have a boolean type", "boolean", vars.getType(new SpecVar("c")));   
    Assert.assertEquals("a should have a Bar type", "Bar", vars.getType(new SpecVar("a")));   
    Assert.assertEquals("b should have a Baz type", "Baz", vars.getType(new SpecVar("b")));   
  }
View Full Code Here

    TestPredicate val = (TestPredicate)pred;
    Assert.assertTrue("Parsed predicate should be positive", val.isPositive());
    Assert.assertTrue("Parsed inner predicate should be negative", !val.getRelationship().isPositive());
    Assert.assertEquals("Inner relationship incorrect", "Foo", val.getRelationship().getRelation().getName());
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain three free variables", 3, vars.size());
    Assert.assertEquals("c should have a boolean type", "boolean", vars.getType(new SpecVar("c")));   
    Assert.assertEquals("a should have a Bar type", "Bar", vars.getType(new SpecVar("a")));   
    Assert.assertEquals("b should have a Baz type", "Baz", vars.getType(new SpecVar("b")));   
  }
View Full Code Here

    TestPredicate val = (TestPredicate)pred;
    Assert.assertTrue("Parsed predicate should be negative", !val.isPositive());
    Assert.assertTrue("Parsed inner predicate should be negative", !val.getRelationship().isPositive());
    Assert.assertEquals("Inner relationship incorrect", "Foo", val.getRelationship().getRelation().getName());
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain three free variables", 3, vars.size());
    Assert.assertEquals("c should have a boolean type", "boolean", vars.getType(new SpecVar("c")));   
    Assert.assertEquals("a should have a Bar type", "Bar", vars.getType(new SpecVar("a")));   
    Assert.assertEquals("b should have a Baz type", "Baz", vars.getType(new SpecVar("b")));   
  }
View Full Code Here

    utils = new TestUtils();
  }
 
  @Test
  public void testFreeVars() {
    FreeVars fv;
    String[] types = utils.getRelation(0).getFullyQualifiedTypes();
   
    RelationshipPredicate lP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(2)});
    RelationshipPredicate rP = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    AndPredicate pred = new AndPredicate(lP, rP);
    fv = pred.getFreeVariables();
 
    assertEquals(types[0], fv.getType(utils.getVar(0)));
    assertEquals(types[1], fv.getType(utils.getVar(1)));
    assertEquals(types[1], fv.getType(utils.getVar(2)));

    assertEquals(3, fv.size());
  }
View Full Code Here

  }

  @Test
  public void testFreeVars() {
    EndOfMethodOp construct = new EndOfMethodOp(null, null, null, null, null, false);
    FreeVars fv = construct.getFreeVariables();
   
    assertEquals(1, fv.size());
  }
View Full Code Here

TOP

Related Classes of edu.cmu.cs.fusion.constraint.FreeVars

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.