Allow a single test to be run

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1062924 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2011-01-24 19:07:57 +00:00
parent fa0d87fd62
commit 8c7b9a1495
1 changed files with 9 additions and 0 deletions

View File

@ -32,6 +32,11 @@ import org.junit.runners.Parameterized.Parameters;
/**
* Test to compare FastMath results against StrictMath results for boundary values.
* <p>
* Running all tests independently: <br/>
* {@code mvn test -Dtest=FastMathStrictComparisonTest}<br/>
* or just run tests against a single method (e.g. scalb):<br/>
* {@code mvn test -Dtest=FastMathStrictComparisonTest -DargLine="-DtestMethod=scalb"}
*/
@RunWith(Parameterized.class)
public class FastMathStrictComparisonTest {
@ -184,6 +189,7 @@ public class FastMathStrictComparisonTest {
@Parameters
public static List<Object[]> data() throws Exception {
String singleMethod = System.getProperty("testMethod");
List<Object[]> list = new ArrayList<Object[]>();
for(Method mathMethod : StrictMath.class.getDeclaredMethods()) {
method:
@ -194,6 +200,9 @@ public class FastMathStrictComparisonTest {
// Get the corresponding FastMath method
Method fastMethod = FastMath.class.getDeclaredMethod(mathMethod.getName(), (Class[]) types);
if (Modifier.isPublic(fastMethod.getModifiers())) { // It must be public too
if (singleMethod != null && !fastMethod.getName().equals(singleMethod)) {
break method;
}
Object [][] values = new Object[types.length][];
int index = 0;
for(Type t : types) {