Package edu.cmu.cs.fusion.constraint

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


   
    Assert.assertTrue("Parsed predicate should be a BOM, but is " + op.getClass().getCanonicalName(), op instanceof BeginOfMethodOp);
   
    BeginOfMethodOp invoke = (BeginOfMethodOp)op;
       
    FreeVars vars = invoke.getFreeVariables();
    Assert.assertEquals("Wrong number of free vars", 3, vars.size());
    Assert.assertEquals("Wrong type", "java.lang.Object", vars.getType(Constraint.RECEIVER));   
    Assert.assertEquals("Wrong type", "Baz", vars.getType(new SpecVar("baz")));   
    Assert.assertEquals("Wrong type", "Bar", vars.getType(new SpecVar("bar")));   
  }
View Full Code Here


    utils = new TestUtils();
  }
 
  @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

   
    Assert.assertTrue("Parsed predicate should be a BOM, but is " + op.getClass().getCanonicalName(), op instanceof BeginOfMethodOp);
   
    BeginOfMethodOp invoke = (BeginOfMethodOp)op;
       
    FreeVars vars = invoke.getFreeVariables();
    Assert.assertEquals("Wrong number of free vars", 2, vars.size());   
    Assert.assertEquals("Wrong type", "Baz", vars.getType(new SpecVar("baz")));   
    Assert.assertEquals("Wrong type", "Bar", vars.getType(new SpecVar("bar")));   
  }
View Full Code Here

   
    Assert.assertTrue("Parsed predicate should be a MethodInvoke, but is " + op.getClass().getCanonicalName(), op instanceof MethodInvocationOp);
   
    MethodInvocationOp invoke = (MethodInvocationOp)op;
       
    FreeVars vars = invoke.getFreeVariables();
    Assert.assertEquals("Wrong number of free vars", 2, vars.size());
    Assert.assertEquals("Wrong type", "Foo", vars.getType(Constraint.RECEIVER));   
    Assert.assertEquals("Wrong type", "Baz", vars.getType(Constraint.RESULT));   
  }
View Full Code Here

   
    Assert.assertTrue("Parsed predicate should be a MethodInvoke, but is " + op.getClass().getCanonicalName(), op instanceof MethodInvocationOp);
   
    MethodInvocationOp invoke = (MethodInvocationOp)op;
       
    FreeVars vars = invoke.getFreeVariables();
    Assert.assertEquals("Wrong number of free vars", 3, vars.size());
    Assert.assertEquals("Wrong type", "Foo", vars.getType(Constraint.RECEIVER));   
    Assert.assertEquals("Wrong type", "Baz", vars.getType(Constraint.RESULT));   
    Assert.assertEquals("Wrong type", "Bar", vars.getType(new SpecVar("bar")));   
  }
View Full Code Here

   
    Assert.assertTrue("Parsed predicate should be a MethodInvoke, but is " + op.getClass().getCanonicalName(), op instanceof MethodInvocationOp);
   
    MethodInvocationOp invoke = (MethodInvocationOp)op;
       
    FreeVars vars = invoke.getFreeVariables();
    Assert.assertEquals("Wrong number of free vars", 4, vars.size());
    Assert.assertEquals("Wrong type", "Foo", vars.getType(Constraint.RECEIVER));   
    Assert.assertEquals("Wrong type", "Baz", vars.getType(Constraint.RESULT));   
    Assert.assertEquals("Wrong type", "Bar", vars.getType(new SpecVar("bar")));   
    Assert.assertEquals("Wrong type", "Baz", vars.getType(new SpecVar("baz")));   
  }
View Full Code Here

   
    Assert.assertTrue("Parsed predicate should be a ConstructorOp, but is " + op.getClass().getCanonicalName(), op instanceof ConstructorOp);
   
    ConstructorOp construct = (ConstructorOp)op;
       
    FreeVars vars = construct.getFreeVariables();
    Assert.assertEquals("Wrong number of free vars", 1, vars.size());
    Assert.assertEquals("Wrong type", "Foo", vars.getType(Constraint.RESULT));       
  }
View Full Code Here

   
    Assert.assertTrue("Parsed predicate should be a ConstructorOp, but is " + op.getClass().getCanonicalName(), op instanceof ConstructorOp);
   
    ConstructorOp construct = (ConstructorOp)op;
       
    FreeVars vars = construct.getFreeVariables();
    Assert.assertEquals("Wrong number of free vars", 2, vars.size());
    Assert.assertEquals("Wrong type", "Foo", vars.getType(Constraint.RESULT));       
    Assert.assertEquals("Wrong type", "Bar", vars.getType(new SpecVar("bar")));       
  }
View Full Code Here

   
    Assert.assertTrue("Parsed predicate should be a ConstructorOp, but is " + op.getClass().getCanonicalName(), op instanceof ConstructorOp);
   
    ConstructorOp construct = (ConstructorOp)op;
       
    FreeVars vars = construct.getFreeVariables();
    Assert.assertEquals("Wrong number of free vars", 3, vars.size());
    Assert.assertEquals("Wrong type", "Foo", vars.getType(Constraint.RESULT));       
    Assert.assertEquals("Wrong type", "Bar", vars.getType(new SpecVar("bar")));       
    Assert.assertEquals("Wrong type", "Baz", vars.getType(new SpecVar("baz")));       
  }
View Full Code Here

  }

  @Test
  public void testEmptyValidLabels() {
    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, null, null, testH, new InferenceEnvironment(null), Variant.PRAGMATIC_VARIANT);
    FreeVars fv = new FreeVars().addVar(new SpecVar("a"), "Foo").addVar(new SpecVar("b"), "Bar");
    Substitution existing = new Substitution().addSub(new SpecVar("a"), labels[0]).addSub(new SpecVar("b"), labels[1]);
   
    List<Substitution> subs = env.allValidSubs(existing, fv);
   
    Iterator<Substitution> itr = subs.iterator();
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.