Package edu.cmu.cs.fusion.constraint.operations

Examples of edu.cmu.cs.fusion.constraint.operations.ConstructorOp


    FPLParser parser = new FPLParser(string, null, new StubIType());
    Operation op = parser.operation();
   
    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


    FPLParser parser = new FPLParser(string, null, new StubIType());
    Operation op = parser.operation();
   
    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

    FPLParser parser = new FPLParser(string, null, new StubIType());
    Operation op = parser.operation();
   
    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 testFreeVars() {
    SpecVar[] vars = new SpecVar[] {utils.getVar(1)};
    ConstructorOp construct = new ConstructorOp("Foo", vars, new String[] {"Bar"});
    FreeVars fv = construct.getFreeVariables();
   
    assertEquals("Foo", fv.getType(Constraint.RESULT));
    assertEquals("Bar", fv.getType(utils.getVar(1)));
   
    assertEquals(2, fv.size());
View Full Code Here

   
    StubMethodCallInstruction instr = new StubMethodCallInstruction("mName", new StubVariable(), params, new StubMethodBinding(rBinding, vBindings), new StubVariable())
   
    SpecVar[] vars = new SpecVar[] {utils.getVar(0)};
    String[] vTypes = new String[] {"Bar"};
    ConstructorOp op = new ConstructorOp("Foo", vars, vTypes);
   
    ConsList<Binding> map = op.matches(new EqualityOnlyTypeHierarchy(), null, instr);

    assertTrue(map == null);
  }
View Full Code Here

 
  @Test
  public void testMatchWrongType() {
    NewObjectInstruction instr = getNOI(new StubVariable(), new StubVariable());
   
    ConstructorOp op = new ConstructorOp("Baz", new SpecVar[] {utils.getVar(1)}, new String[] {"Bar"});
   
    ConsList<Binding> map = op.matches(new EqualityOnlyTypeHierarchy(), null, instr);
   
    assertTrue(map == null);
  }
View Full Code Here

  @Test
  public void testMatchWrongParamType() {
    NewObjectInstruction instr = getNOI(new StubVariable(), new StubVariable());

    ConstructorOp op = new ConstructorOp("Foo", new SpecVar[] {utils.getVar(1)}, new String[] {"Baz"});
   
    ConsList<Binding> map = op.matches(new EqualityOnlyTypeHierarchy(), null, instr);
   
    assertTrue(map == null)
  }
View Full Code Here

  public void testMatchWrongParamNums() {
    NewObjectInstruction instr = getNOI(new StubVariable(), new StubVariable());

    SpecVar[] vars = new SpecVar[] {utils.getVar(0), utils.getVar(1)};
    String[] vTypes = new String[] {"Bar", "Baz"};
    ConstructorOp op = new ConstructorOp("Foo", vars, vTypes);
   
    ConsList<Binding> map = op.matches(new EqualityOnlyTypeHierarchy(), null, instr);
   
    assertTrue(map == null);
   
 
View Full Code Here

    StubVariable param = new StubVariable();

    NewObjectInstruction instr = getNOI(target, param);
    SpecVar[] vars = new SpecVar[] {utils.getVar(0)};
    String[] vTypes = new String[] {"Bar"};
    ConstructorOp op = new ConstructorOp("Foo", vars, vTypes);
   
    ConsList<Binding> list = op.matches(new EqualityOnlyTypeHierarchy(), null, instr);
   
    assertTrue(list != null);
    assertTrue(list.contains(new Binding(Constraint.RESULT, target)));
    assertTrue(list.contains(new Binding(utils.getVar(0), param)));
   
View Full Code Here

    StubVariable target = new StubVariable();

    NewObjectInstruction instr = getNOI(target, target);
    SpecVar[] vars = new SpecVar[] {utils.getVar(0)};
    String[] vTypes = new String[] {"Bar"};
    ConstructorOp op = new ConstructorOp("Foo", vars, vTypes);
   
    ConsList<Binding> list = op.matches(new EqualityOnlyTypeHierarchy(), null, instr);
   
    assertTrue(list != null);
    assertTrue(list.contains(new Binding(Constraint.RESULT, target)));
    assertTrue(list.contains(new Binding(utils.getVar(0), target)));
   
View Full Code Here

TOP

Related Classes of edu.cmu.cs.fusion.constraint.operations.ConstructorOp

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.