MPJCOVERAGE-14. Fixed overview and packages rates.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116027 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
04d2f2d0e7
commit
6fe877be14
@ -26,7 +26,7 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Emmanuel Venisse
|
* @author Emmanuel Venisse
|
||||||
* @version $Id: Coverage.java,v 1.4 2004/03/06 22:41:56 evenisse Exp $
|
* @version $Id: Coverage.java,v 1.5 2004/09/03 07:58:59 evenisse Exp $
|
||||||
*/
|
*/
|
||||||
public class Coverage
|
public class Coverage
|
||||||
{
|
{
|
||||||
@ -123,6 +123,7 @@ public class Coverage
|
|||||||
|
|
||||||
public String getCoveredPercentBranch()
|
public String getCoveredPercentBranch()
|
||||||
{
|
{
|
||||||
|
double totalLines = 0.00d;
|
||||||
double total = 0.00d;
|
double total = 0.00d;
|
||||||
|
|
||||||
if (getLineCoverage() > 0.00d)
|
if (getLineCoverage() > 0.00d)
|
||||||
@ -130,6 +131,7 @@ public class Coverage
|
|||||||
for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
|
for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
|
||||||
{
|
{
|
||||||
Clazz theClass = (Clazz) iter.next();
|
Clazz theClass = (Clazz) iter.next();
|
||||||
|
int classLines = theClass.getLines().size();
|
||||||
double rate = 0;
|
double rate = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -139,19 +141,24 @@ public class Coverage
|
|||||||
{
|
{
|
||||||
rate = 0;
|
rate = 0;
|
||||||
}
|
}
|
||||||
total += rate;
|
total += (rate*classLines);
|
||||||
}
|
totalLines += classLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.valueOf(total / getClasses().size());
|
total /= totalLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.valueOf(total);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getLineCoverage()
|
private double getLineCoverage()
|
||||||
{
|
{
|
||||||
double total = 0.00d;
|
double totalLines = 0.00d;
|
||||||
|
double totalTestedLines = 0.00d;
|
||||||
for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
|
for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
|
||||||
{
|
{
|
||||||
Clazz theClass = (Clazz) iter.next();
|
Clazz theClass = (Clazz) iter.next();
|
||||||
|
int classLines = theClass.getLines().size();
|
||||||
double rate = 0;
|
double rate = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -161,8 +168,11 @@ public class Coverage
|
|||||||
{
|
{
|
||||||
rate = 0;
|
rate = 0;
|
||||||
}
|
}
|
||||||
total += rate;
|
totalTestedLines += (rate * classLines);
|
||||||
|
totalLines += classLines;
|
||||||
}
|
}
|
||||||
return total / getClasses().size();
|
|
||||||
|
return (totalTestedLines / totalLines);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Emmanuel Venisse
|
* @author Emmanuel Venisse
|
||||||
* @version $Id: Package.java,v 1.5 2004/03/06 22:41:56 evenisse Exp $
|
* @version $Id: Package.java,v 1.6 2004/09/03 07:58:59 evenisse Exp $
|
||||||
*/
|
*/
|
||||||
public class Package
|
public class Package
|
||||||
{
|
{
|
||||||
@ -91,6 +91,7 @@ public class Package
|
|||||||
|
|
||||||
public String getCoveredPercentBranch()
|
public String getCoveredPercentBranch()
|
||||||
{
|
{
|
||||||
|
double pckgLines = 0.00d;
|
||||||
double total = 0.00d;
|
double total = 0.00d;
|
||||||
|
|
||||||
if (getLineCoverage() > 0.00d)
|
if (getLineCoverage() > 0.00d)
|
||||||
@ -98,6 +99,7 @@ public class Package
|
|||||||
for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
|
for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
|
||||||
{
|
{
|
||||||
Clazz theClass = (Clazz) iter.next();
|
Clazz theClass = (Clazz) iter.next();
|
||||||
|
int classLines = theClass.getLines().size();
|
||||||
double rate = 0;
|
double rate = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -107,10 +109,11 @@ public class Package
|
|||||||
{
|
{
|
||||||
rate = 0;
|
rate = 0;
|
||||||
}
|
}
|
||||||
total += rate;
|
total += (rate*classLines);
|
||||||
|
pckgLines += classLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
total /= getClasses().size();
|
total /= pckgLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.valueOf(total);
|
return String.valueOf(total);
|
||||||
@ -118,11 +121,12 @@ public class Package
|
|||||||
|
|
||||||
private double getLineCoverage()
|
private double getLineCoverage()
|
||||||
{
|
{
|
||||||
double total = 0.00d;
|
double pckgLines = 0.00d;
|
||||||
|
double pckgTestedLines = 0.00d;
|
||||||
for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
|
for (Iterator iter = getClasses().iterator(); iter.hasNext(); )
|
||||||
{
|
{
|
||||||
Clazz theClass = (Clazz) iter.next();
|
Clazz theClass = (Clazz) iter.next();
|
||||||
|
int classLines = theClass.getLines().size();
|
||||||
double rate = 0;
|
double rate = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -132,9 +136,10 @@ public class Package
|
|||||||
{
|
{
|
||||||
rate = 0;
|
rate = 0;
|
||||||
}
|
}
|
||||||
total += rate;
|
pckgTestedLines += (rate * classLines);
|
||||||
|
pckgLines += classLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (total / getClasses().size());
|
return (pckgTestedLines / pckgLines);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
</properties>
|
</properties>
|
||||||
<body>
|
<body>
|
||||||
<release version="1.0.8" date="In CVS">
|
<release version="1.0.8" date="In CVS">
|
||||||
|
<action dev="evenisse" type="fix" issue="MPJCOVERAGE-14">Fixed overview and packages rates.</action>
|
||||||
<action dev="evenisse" type="add">Add the possibility to set multiple includes and excludes files for instrumentation.</action>
|
<action dev="evenisse" type="add">Add the possibility to set multiple includes and excludes files for instrumentation.</action>
|
||||||
</release>
|
</release>
|
||||||
<release version="1.0.7" date="2004-07-11">
|
<release version="1.0.7" date="2004-07-11">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user