public class EngineeringFormatterTest extends Object
Copyright (c) 2015-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
Constructor and Description |
---|
EngineeringFormatterTest() |
Modifier and Type | Method and Description |
---|---|
void |
constructorTest()
See if we can increase the code coverage to include the private constructor.
|
static String |
convertAndVerify(double val,
int room)
Call convert and then verify that the result is an accurate representation of the value.
|
void |
doULPTest()
Test cleverly chosen values plus and minus one ULP.
|
void |
doWidthTest()
Check that values are formatted at optimal precision when the room is varied.
|
static void |
testD(double d,
int width)
Print result of main value and value plus or minus one ULP.
|
void |
ulpTest()
Run ulpTest with both values of the parameter.
|
static void |
verifyResult(double value,
String text,
int room)
Check that a double value is represented by a string as accurately as possible; i.e.
|
void |
widthTest()
Run widthTest with both values of the parameter.
|
public final void constructorTest() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
InstantiationException
- on reflection errorIllegalAccessException
- on reflection errorIllegalArgumentException
- on reflection errorInvocationTargetException
- on reflection errorpublic final void ulpTest()
public final void doULPTest()
public final void widthTest()
public final void doWidthTest()
public static void testD(double d, int width)
d
- double; the valuewidth
- int; width parameter of the converterpublic static String convertAndVerify(double val, int room)
val
- double; value to convertroom
- int; width of the output of convertpublic static void verifyResult(double value, String text, int room)
value
- double; the valuetext
- String; the textual representation of valueroom
- int; the expected length of the textCopyright © 2015–2019 Delft University of Technology. All rights reserved.