Package eu.simuline.testhelpers
Class DTestHelper
- java.lang.Object
-
- eu.simuline.testhelpers.DTestHelper
-
public abstract class DTestHelper extends java.lang.Object
Creates double values for tests. Created: Tue Mar 20 01:05:54 2012- Version:
- 1.0
- Author:
- Ernst Reissner
-
-
Field Summary
Fields Modifier and Type Field Description private static double
FRAC_NON_NAN
private static int
MAX_NUM_ARGS
private static int
RANGE_POW2
-
Constructor Summary
Constructors Constructor Description DTestHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
createArgD(boolean isSigned)
static double
createArgD(boolean isSigned, int exp0, int exp1)
Returns a random number which is signed if demanded byisSigned
and which ranges from the given exponents.static java.util.List<java.lang.Double>
createMultArgsD(boolean signed, boolean inRange, boolean allowsNaN)
static java.util.List<java.lang.Double>
createMultArgsD(int numArgs, boolean allowsSigned, boolean inRange, boolean allowsNaN)
static java.util.List<java.lang.Double>
createMultArgsSumD(boolean signed, boolean inRange)
static java.util.List<java.lang.Double>
createMultArgsSumD(int numArgs, boolean signed, boolean inRange)
Returns a list ofnumArgs
arguments as double values.private static int
createNumArgs()
private static double
createPower2()
(package private) static double
random(boolean signed)
Returns a random number with absolute value in[0,1]
.
-
-
-
Field Detail
-
MAX_NUM_ARGS
private static final int MAX_NUM_ARGS
- See Also:
- Constant Field Values
-
FRAC_NON_NAN
private static final double FRAC_NON_NAN
- See Also:
- Constant Field Values
-
RANGE_POW2
private static final int RANGE_POW2
- See Also:
- Constant Field Values
-
-
Method Detail
-
random
static double random(boolean signed)
Returns a random number with absolute value in[0,1]
.- Parameters:
signed
- whether the number returned may be negative.- Returns:
- a random number
- in
[-1,1]
ifsigned
. - in
[ 0,1]
if!signed
.
- in
-
createArgD
public static double createArgD(boolean isSigned)
-
createArgD
public static double createArgD(boolean isSigned, int exp0, int exp1)
Returns a random number which is signed if demanded byisSigned
and which ranges from the given exponents.
-
createMultArgsSumD
public static java.util.List<java.lang.Double> createMultArgsSumD(int numArgs, boolean signed, boolean inRange)
Returns a list ofnumArgs
arguments as double values. The sum of all numbers are restricted as specified by the parameters.- Parameters:
numArgs
- the length of the argument list to be returned.signed
- whether the arguments may be negative.inRange
- whether the sum of the entries in the result List is in[0,1)
or, ifsigned
in(-1,1)
.- Returns:
- a list of
numArgs
arguments as double values. The sum of all numbers is in[0,1)
and for!signed
even in[0.5,1)
. The entries are in[0,1)
for!signed
and in(-1,1)
forsigned
.
-
createNumArgs
private static int createNumArgs()
-
createMultArgsSumD
public static java.util.List<java.lang.Double> createMultArgsSumD(boolean signed, boolean inRange)
-
createMultArgsD
public static java.util.List<java.lang.Double> createMultArgsD(int numArgs, boolean allowsSigned, boolean inRange, boolean allowsNaN)
-
createPower2
private static double createPower2()
-
createMultArgsD
public static java.util.List<java.lang.Double> createMultArgsD(boolean signed, boolean inRange, boolean allowsNaN)
-
-