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

Examples of edu.cmu.cs.fusion.test.constraint.operations.StubMethodCallInstruction


  @Test
  public void testCombined() throws FusionException {
    RelationshipContext rels = new RelationshipContext(false);

    StubMethodCallInstruction instr = getMCI();
   
    TestAliasContext aliases = new TestAliasContext();
    aliases.addAlias(instr.getReceiverOperand(), labels[0]);
    aliases.addAlias(instr.getTarget(), labels[3]);
    aliases.addAlias(instr.getArgOperands().get(0), labels[1]);
    aliases.addAlias(instr.getArgOperands().get(0), labels[2]);

    AliasDelta expected = new AliasDelta();
    expected.addChange(instr.getReceiverOperand(), labels[0]);
    expected.addChange(instr.getTarget(), labels[3]);
    expected.addChange(instr.getArgOperands().get(0), labels[1])
    expected.addChange(instr.getArgOperands().get(0), labels[2])

    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, rels, null, types, new InferenceEnvironment(null), variant);   
    Pair<RelationshipDelta, AliasDelta> deltas = runSingleConstraint(env, cons, instr);
    FusionErrorReport error = checkSingleConstraint(env, cons, instr);
    Relationship eff1 = new Relationship(utils.getRelation(0), new ObjectLabel[]{labels[0], labels[1]});
View Full Code Here


 
  private StubMethodCallInstruction getMCI() {
    List<StubVariable> vars = new LinkedList<StubVariable>();
    vars.add(new StubVariable("p0""Bar"));
   
    StubMethodCallInstruction instr = new StubMethodCallInstruction("methodName", new StubVariable("rVar", "Foo"), vars,
         new StubMethodBinding(new NamedTypeBinding("Foo"), new NamedTypeBinding[]{new NamedTypeBinding("Bar")}), new StubVariable("tVar", "java.lang.Object"));
    return instr;
  }
View Full Code Here

   * aliasing configuration!
   */
  public void testNoMatches() throws FusionException {
    RelationshipContext rels = new RelationshipContext(false);
   
    StubMethodCallInstruction instr = getMCI();
   
    //op has type Foo.methodName(Foo) : Bar
    //instr has type Foo.m(Foo) : Bar
   
    TestAliasContext aliases = new TestAliasContext();
    aliases.addAlias(instr.getReceiverOperand(), labels[5]);
    aliases.addAlias(instr.getTarget(), labels[0]);
    aliases.addAlias(instr.getArgOperands().get(0), labels[3]);

    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, rels, null, types, new InferenceEnvironment(null), variant);   
    Pair<RelationshipDelta, AliasDelta> deltas = runSingleConstraint(env, cons, instr);
    FusionErrorReport error = checkSingleConstraint(env, cons, instr);
   
View Full Code Here

 
  @Test
  public void testDefOnly() throws FusionException {
    RelationshipContext rels = new RelationshipContext(false);

    StubMethodCallInstruction instr = getMCI();
   
    TestAliasContext aliases = new TestAliasContext();
    aliases.addAlias(instr.getReceiverOperand(), labels[0]);
    aliases.addAlias(instr.getTarget(), labels[3]);
    aliases.addAlias(instr.getArgOperands().get(0), labels[5]);
   
    AliasDelta expected = new AliasDelta();
    expected.addChange(instr.getReceiverOperand(), labels[0]);
    expected.addChange(instr.getTarget(), labels[3]);
    expected.addChange(instr.getArgOperands().get(0), labels[5])


    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, rels, null, types, new InferenceEnvironment(null), variant);   
    Pair<RelationshipDelta, AliasDelta> deltas = runSingleConstraint(env, cons, instr);
    FusionErrorReport error = checkSingleConstraint(env, cons, instr);
View Full Code Here

 
  @Test
  public void testPartialOnly() throws FusionException {
    RelationshipContext rels = new RelationshipContext(false);

    StubMethodCallInstruction instr = getMCI();
   
    TestAliasContext aliases = new TestAliasContext();
    aliases.addAlias(instr.getReceiverOperand(), labels[0]);
    aliases.addAlias(instr.getTarget(), labels[3]);
    aliases.addAlias(instr.getArgOperands().get(0), labels[2]);
   
    AliasDelta expected = new AliasDelta();
    expected.addChange(instr.getReceiverOperand(), labels[0]);
    expected.addChange(instr.getTarget(), labels[3]);
    expected.addChange(instr.getArgOperands().get(0), labels[2])

    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, rels, null, types, new InferenceEnvironment(null), variant);   
    Pair<RelationshipDelta, AliasDelta> deltas = runSingleConstraint(env, cons, instr);
    FusionErrorReport error = checkSingleConstraint(env, cons, instr);
    Relationship eff1 = new Relationship(utils.getRelation(0), new ObjectLabel[]{labels[0], labels[2]});
View Full Code Here

 
  @Test
  public void testSeveralDef() throws FusionException {
    RelationshipContext rels = new RelationshipContext(false);

    StubMethodCallInstruction instr = getMCI();
   
    TestAliasContext aliases = new TestAliasContext();
    aliases.addAlias(instr.getReceiverOperand(), labels[0]);
    aliases.addAlias(instr.getTarget(), labels[3]);
    aliases.addAlias(instr.getTarget(), labels[4]);
    aliases.addAlias(instr.getArgOperands().get(0), labels[5]);
   
    AliasDelta expected = new AliasDelta();
    expected.addChange(instr.getReceiverOperand(), labels[0]);
    expected.addChange(instr.getTarget(), labels[3]);
    expected.addChange(instr.getTarget(), labels[4]);
    expected.addChange(instr.getArgOperands().get(0), labels[5])

    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, rels, null, types, new InferenceEnvironment(null), variant);   
    Pair<RelationshipDelta, AliasDelta> deltas = runSingleConstraint(env, cons, instr);
    FusionErrorReport error = checkSingleConstraint(env, cons, instr);
    Relationship eff1 = new Relationship(utils.getRelation(0), new ObjectLabel[]{labels[0], labels[5]});
View Full Code Here

TOP

Related Classes of edu.cmu.cs.fusion.test.constraint.operations.StubMethodCallInstruction

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.