Package edu.cmu.cs.fusion.constraint

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


    RelEffect effect = parser.relEffect();
   
    Assert.assertEquals("Effect type is wrong", RelEffect.EffectType.ADD, effect.getType());
    Assert.assertEquals("Effect relation is wrong", "Foo", effect.getRelation().getName());
   
    FreeVars vars = effect.getFreeVariables();
    Assert.assertEquals("Should only contain two free variables", 2, vars.size());
    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


    RelEffect effect = parser.relEffect();
   
    Assert.assertEquals("Effect type is wrong", RelEffect.EffectType.REMOVE, effect.getType());
    Assert.assertEquals("Effect relation is wrong", "Foo", effect.getRelation().getName());
   
    FreeVars vars = effect.getFreeVariables();
    Assert.assertEquals("Should only contain two free variables", 2, vars.size());
    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

    RelEffect effect = parser.relEffect();
   
    Assert.assertEquals("Effect type is wrong", RelEffect.EffectType.REMOVE, effect.getType());
    Assert.assertEquals("Effect relation is wrong", "Foo", effect.getRelation().getName());
   
    FreeVars vars = effect.getFreeVariables();
    FreeVars wcs = effect.getWildCards();
    Assert.assertEquals("Should only contain one free variable", 1, vars.size());
    Assert.assertEquals("But actually has two!", 2, effect.getVars().length)
    Assert.assertEquals("one wildcard", 1, wcs.size());
    Assert.assertTrue("The first param should be a wildcard!", effect.getVars()[0].isWildCard());   
    Assert.assertEquals("wild card should have a Bar type", "Bar", wcs.getType(effect.getVars()[0]));   
    Assert.assertTrue("The second param should be normal", !effect.getVars()[1].isWildCard());
    Assert.assertEquals("b should have a Baz type", "Baz", vars.getType(new SpecVar("b")));   
  }
View Full Code Here

    RelEffect effect = parser.relEffect();
   
    Assert.assertEquals("Effect type is wrong", RelEffect.EffectType.TEST, effect.getType());
    Assert.assertEquals("Effect relation is wrong", "Foo", effect.getRelation().getName());
   
    FreeVars vars = effect.getFreeVariables();
    Assert.assertEquals("Should only contain three free variables", 3, vars.size());
    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")));   
    Assert.assertEquals("c should have a boolean type", "boolean", vars.getType(new SpecVar("c")));   
  }
View Full Code Here

    RelEffect effect = parser.relEffect();
   
    Assert.assertEquals("Effect type is wrong", RelEffect.EffectType.NEG_TEST, effect.getType());
    Assert.assertEquals("Effect relation is wrong", "Foo", effect.getRelation().getName());
   
    FreeVars vars = effect.getFreeVariables();
    Assert.assertEquals("Should only contain three free variables", 3, vars.size());
    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")));   
    Assert.assertEquals("c should have a boolean type", "boolean", vars.getType(new SpecVar("c")));   
  }
View Full Code Here

  @Test
  public void testFreeVarsNormal() {
    Effect eff = RelEffect.createAddEffect(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    String[] types = utils.getRelation(0).getFullyQualifiedTypes();
    FreeVars fv = eff.getFreeVariables();
   
    assertEquals(types[0], fv.getType(utils.getVar(0)));
    assertEquals(types[1], fv.getType(utils.getVar(1)));

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

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

 
  @Test
  public void testFreeVarsTest() {
    Effect eff = RelEffect.createNegatedTestEffect(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)}, utils.getVar(2));
    String[] types = utils.getRelation(0).getFullyQualifiedTypes();
    FreeVars fv = eff.getFreeVariables();
   
    assertEquals(types[0], fv.getType(utils.getVar(0)));
    assertEquals(types[1], fv.getType(utils.getVar(1)));
    assertEquals(FreeVars.BOOL_TYPE, fv.getType(utils.getVar(2)));

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

    FreeVars.setHierarchy(testH);
  }
 
  @Test
  public void testAdd() throws FusionException {
    FreeVars vars = new FreeVars();
    vars = vars.addVar(new SpecVar("foo"), "Foo");
    assertEquals(1, vars.size());
    assertEquals("Foo", vars.getType(new SpecVar("foo")));
  }
View Full Code Here

    assertEquals("Foo", vars.getType(new SpecVar("foo")));
  }
 
  @Test
  public void testUnionNormal() throws FusionException {
    FreeVars vars1 = new FreeVars();
    vars1 = vars1.addVar(new SpecVar("foo"), "Foo");

    FreeVars vars2 = new FreeVars();
    vars2 = vars2.addVar(new SpecVar("bar"), "Bar");
    vars2 = vars2.union(vars1);
    assertEquals(2, vars2.size());
    assertEquals("Foo", vars2.getType(new SpecVar("foo")));
    assertEquals("Bar", vars2.getType(new SpecVar("bar")));
  }
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.