Package com.google.test.metric

Examples of com.google.test.metric.MethodCost


        "getInstance()Lcom/google/test/metric/example/GlobalExample$Gadget;");
    assertEquals(0, cost.getTotalGlobalCost());
  }

  public void testAccessingAFinalFieldDoesNotCountAgainstYou() throws Exception {
    MethodCost cost = cost(GlobalExample.class,
        "getGlobalId()Ljava/lang/String;");
    assertEquals(0, cost.getTotalGlobalCost());
  }
View Full Code Here


  }

  public void test2DeepPrintAll() throws Exception {
    DrillDownReport printer =
      new DrillDownReport(new PrintStream(out), null, MAX_VALUE, 0);
    methodCost2.addMethodCost(81, new MethodCost("c.g.t.A.method1()V", 0, 1));
    methodCost2.link(context);
    printer.print("", methodCost2, MAX_VALUE);
    assertStringEquals("c.g.t.A.method2()V [2, 0 / 3, 0]\n" +
        "  line 81: c.g.t.A.method1()V [1, 0 / 1, 0]\n", out.toString());
  }
View Full Code Here

  }

  public void testSupressAllWhenMinCostIs4() throws Exception {
    DrillDownReport printer =
      new DrillDownReport(new PrintStream(out), null, MAX_VALUE, 4);
    methodCost2.addMethodCost(81, new MethodCost("c.g.t.A.method1()V", 0, 1));
    methodCost2.link(context);
    printer.print("", methodCost2, MAX_VALUE);
    assertStringEquals("", out.toString());
  }
View Full Code Here

  }

  public void testSupressPartialWhenMinCostIs2() throws Exception {
    DrillDownReport printer =
      new DrillDownReport(new PrintStream(out), null, MAX_VALUE, 2);
    methodCost2.addMethodCost(81, new MethodCost("c.g.t.A.method1()V", 0, 1));
    methodCost2.link(context);
    printer.print("", methodCost2, Integer.MAX_VALUE);
    assertStringEquals("c.g.t.A.method2()V [2, 0 / 3, 0]\n", out.toString());
  }
View Full Code Here

    }
  }

  private void print(String prefix, LineNumberCost line, int maxDepth,
      Set<String> alreadSeen) {
    MethodCost method = line.getMethodCost();
    if (shouldPrint(method, maxDepth, alreadSeen)) {
      out.print(prefix);
      out.print("line ");
      out.print(line.getLineNumber());
      out.print(": ");
      out.println(method);
      for (LineNumberCost child : method.getOperationCosts()) {
        print("  " + prefix, child, maxDepth - 1, alreadSeen);
      }
    }
  }
View Full Code Here

TOP

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

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.