Package com.google.test.metric

Examples of com.google.test.metric.Variable


  }

  @Override
  public Operation toOperation(List<Variable> input) {
    List<Variable> parameters = removeDuplicateSlots(input);
    Variable methodThis = isStatic ? null : parameters.remove(0);
    return new MethodInvocation(lineNumber, clazz, name,
        methodThis, parameters, returnValue);
  }
View Full Code Here


  @Override
  public Operation toOperation(List<Variable> input) {
    if (!input.get(0).getType().isObject()) {
      throw new IllegalStateException();
    }
    Variable array = input.get(0);
    Variable index = input.get(1);
    Variable value = input.get(2);
    return new ArrayAssignment(lineNumber, array, index, value);
  }
View Full Code Here

  @Override
  public Operation toOperation(List<Variable> input) {
    if (!input.get(0).getType().isObject()) {
      throw new IllegalStateException();
    }
    Variable array = input.get(0);
    Variable index = input.get(1);
    Variable value = input.get(2);
    return new ArrayAssignment(lineNumber, array, index, value);
  }
View Full Code Here

  }

  protected void assertValid(List<Variable> variables) {
    Iterator<Variable> iter = variables.iterator();
    while (iter.hasNext()) {
      final Variable variable = iter.next();
      if (variable.getType().isDoubleSlot()) {
        Variable varNext = iter.hasNext() ? iter.next() : null;
        if (variable != varNext) {
          throw new IllegalStateException("Variable list '"
              + variables + "' contanins variable '" + variable
              + "' which is a double but the next "
              + "variable in the list is not a duplicate.");
View Full Code Here

  }

  public void visitLocalVariable(String name, String desc, String signature,
      Label start, Label end, int slotNum) {
    Type type = Type.fromDesc(desc);
    Variable variable = slots.get(slotNum);
    if (variable == null) {
      LocalVariableInfo localVar = new LocalVariableInfo(name, type);
      slots.put(slotNum, localVar);
      localVariables.add(localVar);
    } else {
      variable.setName(name);
    }
  }
View Full Code Here

    Label runtimeHandler = new Label();
    Label catchEnd = new Label();
    Label finallyHandler = new Label();
    Label l20 = new Label();
    Label l22 = new Label();
    Variable b = new LocalVariableInfo("b", Type.INT);
    Variable e = new LocalVariableInfo("e", Type.OBJECT);
    Variable any = new LocalVariableInfo("any", Type.OBJECT);
    decomposer.tryCatchBlock(tryStart, tryEnd, runtimeHandler, "java/lang/RuntimeException");
    decomposer.tryCatchBlock(tryStart, catchEnd, finallyHandler, null);

    /* 0*/ decomposer.addOp(new Load(0, new Constant(1, Type.INT)));
    /* 1*/ decomposer.addOp(new Store(1, b));
View Full Code Here

public class Duplicate2Test extends TestCase {

  public void testDup2Single() throws Exception {
    Duplicate2 dup2 = new Duplicate2(1, 0);
    assertEquals(2, dup2.getOperatorCount());
    Variable v1 = var(1);
    Variable v2 = var(2);
    List<Variable> out = dup2.apply(asList(v1, v2));
    assertList(out, v1, v2, v1, v2);
    assertEquals("duplicate2", dup2.toString());
  }
View Full Code Here

  }

  public void testDup2Double() throws Exception {
    Duplicate2 dup2 = new Duplicate2(1, 0);
    assertEquals(2, dup2.getOperatorCount());
    Variable v1 = var(1l);
    List<Variable> out = dup2.apply(asList(v1, v1));
    assertList(out, v1, v1, v1, v1);
    assertEquals("duplicate2", dup2.toString());
  }
View Full Code Here

  }

  public void testDup2Offset1Single() throws Exception {
    Duplicate2 dup2 = new Duplicate2(1, 1);
    assertEquals(3, dup2.getOperatorCount());
    Variable v1 = var(1);
    Variable v2 = var(2);
    Variable v3 = var(3);
    List<Variable> out = dup2.apply(asList(v3, v2, v1));
    assertList(out, v2, v1, v3, v2, v1);
    assertEquals("duplicate2_X1", dup2.toString());
  }
View Full Code Here

  }

  public void testDup2Offset1Double() throws Exception {
    Duplicate2 dup2 = new Duplicate2(1, 1);
    assertEquals(3, dup2.getOperatorCount());
    Variable v1 = var(1l);
    Variable v2 = var(2);
    List<Variable> out = dup2.apply(asList(v2, v1, v1));
    assertList(out, v1, v1, v2, v1, v1);
    assertEquals("duplicate2_X1", dup2.toString());
  }
View Full Code Here

TOP

Related Classes of com.google.test.metric.Variable

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.