Package com.google.test.metric

Examples of com.google.test.metric.GlobalCost


        write("L" + violation.getLocation().getLineNumber() + ",");
      }

    };
    MethodCost methodCost = new MethodCost("", "methodName", 123, false, false, false);
    methodCost.addCostSource(new GlobalCost(new SourceLocation(null, 123), null, Cost.global(1)));
    methodCost.addCostSource(new CyclomaticCost(new SourceLocation(null, 234), Cost.cyclomatic(1)));
    methodCost.addCostSource(new CyclomaticCost(new SourceLocation(null, 345), Cost.cyclomatic(1)));
    methodCost.addCostSource(new GlobalCost(new SourceLocation(null, 456), null, Cost.global(1)));
    methodCost.link();
    report.writeCost(methodCost);
    assertXMLEquals("<method cyclomatic=\"2\" global=\"2\" line=\"123\" "
        + "lod=\"0\" name=\"methodName\" overall=\"22\">L123,L234,L345,L456,</method>");
  }
View Full Code Here


  public void testSimpleCost() throws Exception {
    DrillDownReportGenerator printer =
      new DrillDownReportGenerator(new PrintStream(out), costModel, null, MAX_VALUE, 0);
    MethodCost costOnlyMethod1 = new MethodCost("", "c.g.t.A.method1()V", 0, false, false, false);
    costOnlyMethod1.addCostSource(new CyclomaticCost(new SourceLocation(null, 1), Cost.cyclomatic(1)));
    costOnlyMethod1.addCostSource(new GlobalCost(new SourceLocation(null, 0), null, Cost.global(1)));
    costOnlyMethod1.link();
    printer.print("", costOnlyMethod1, Integer.MAX_VALUE);
    assertStringEquals("c.g.t.A.method1()V [CC: 1, GC: 1 / CC: 1, GC: 1]\n", out.toString());
  }
View Full Code Here

public class MethodCostTest extends TestCase {

  public void testComputeOverallCost() throws Exception {
    MethodCost cost = new MethodCost("", "a", 0, false, false, false);
    cost.addCostSource(new CyclomaticCost(new SourceLocation(null, 0), Cost.cyclomatic(1)));
    cost.addCostSource(new GlobalCost(new SourceLocation(null, 0), null, Cost.global(1)));
    MethodCost cost3 = new MethodCost("", "b", 0, false, false, false);
    cost3.addCostSource(new CyclomaticCost(new SourceLocation(null, 0), Cost.cyclomatic(1)));
    cost3.addCostSource(new CyclomaticCost(new SourceLocation(null, 0), Cost.cyclomatic(1)));
    cost3.addCostSource(new CyclomaticCost(new SourceLocation(null, 0), Cost.cyclomatic(1)));
    cost.addCostSource(new MethodInvocationCost(new SourceLocation(null, 0), cost3,
View Full Code Here

TOP

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

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.