From 77e64c0cb71a5b3a920f786e3781de568ebf9041 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Mon, 24 Jan 2011 19:09:26 +0000 Subject: [PATCH] Allow a single test to be run git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/branches/MATH_2_X@1062926 13f79535-47bb-0310-9956-ffa450edef68 --- .../math/util/FastMathStrictComparisonTest.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/apache/commons/math/util/FastMathStrictComparisonTest.java b/src/test/java/org/apache/commons/math/util/FastMathStrictComparisonTest.java index ff7cbc5ac..22efebf93 100644 --- a/src/test/java/org/apache/commons/math/util/FastMathStrictComparisonTest.java +++ b/src/test/java/org/apache/commons/math/util/FastMathStrictComparisonTest.java @@ -32,6 +32,11 @@ import org.junit.runners.Parameterized.Parameters; /** * Test to compare FastMath results against StrictMath results for boundary values. + *

+ * Running all tests independently:
+ * {@code mvn test -Dtest=FastMathStrictComparisonTest}
+ * or just run tests against a single method (e.g. scalb):
+ * {@code mvn test -Dtest=FastMathStrictComparisonTest -DargLine="-DtestMethod=scalb"} */ @RunWith(Parameterized.class) public class FastMathStrictComparisonTest { @@ -57,13 +62,13 @@ public class FastMathStrictComparisonTest { }; private static final Object [] LONG_SPECIAL_VALUES = { - -1,0,1, - Long.MIN_VALUE, Long.MAX_VALUE, + -1,0,1, // 1,2,3 + Long.MIN_VALUE, Long.MAX_VALUE, // 4,5 }; private static final Object[] INT_SPECIAL_VALUES = { - -1,0,1, - Integer.MIN_VALUE, Integer.MAX_VALUE, + -1,0,1, // 1,2,3 + Integer.MIN_VALUE, Integer.MAX_VALUE, // 4,5 }; private final Method mathMethod; @@ -184,6 +189,7 @@ public class FastMathStrictComparisonTest { @Parameters public static List data() throws Exception { + String singleMethod = System.getProperty("testMethod"); List list = new ArrayList(); 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) {