Package ucar.unidata.util.test
Class Assert2
- java.lang.Object
-
- ucar.unidata.util.test.Assert2
-
public class Assert2 extends Object
Custom JUnit 4 assertions.- Since:
- 2018-05-13
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
assertArrayNearlyEquals(double[] expecteds, double[] actuals)
Returns the result ofassertArrayNearlyEquals(double[], double[], double)
, withMisc.defaultMaxRelativeDiffDouble
.static void
assertArrayNearlyEquals(double[] expecteds, double[] actuals, double maxRelDiff)
Same asassertArrayNearlyEquals(float[], float[], float)
, but for doubles.static void
assertArrayNearlyEquals(float[] expecteds, float[] actuals)
Returns the result ofassertArrayNearlyEquals(float[], float[], float)
, withMisc.defaultMaxRelativeDiffFloat
.static void
assertArrayNearlyEquals(float[] expecteds, float[] actuals, float maxRelDiff)
Asserts that two float arrays are nearly equal by comparing analogous elements in the two arrays withMisc.nearlyEquals(float, float, float)
.static void
assertNearlyEquals(double expected, double actual)
Returns the result ofassertNearlyEquals(double, double, double)
, withMisc.defaultMaxRelativeDiffDouble
.static void
assertNearlyEquals(double expected, double actual, double maxRelDiff)
Same asassertNearlyEquals(float, float, float)
, but for doubles.static void
assertNearlyEquals(float expected, float actual)
Returns the result ofassertNearlyEquals(float, float, float)
, withMisc.defaultMaxRelativeDiffFloat
.static void
assertNearlyEquals(float expected, float actual, float maxRelDiff)
Asserts that two floats arenearly equal
.
-
-
-
Method Detail
-
assertNearlyEquals
public static void assertNearlyEquals(float expected, float actual)
Returns the result ofassertNearlyEquals(float, float, float)
, withMisc.defaultMaxRelativeDiffFloat
.
-
assertNearlyEquals
public static void assertNearlyEquals(float expected, float actual, float maxRelDiff)
Asserts that two floats arenearly equal
. If they are not, anAssertionError
is thrown.- Parameters:
expected
- expected valueactual
- the value to check againstexpected
maxRelDiff
- the maximum relative difference the two numbers may have and still be considered equal.
-
assertNearlyEquals
public static void assertNearlyEquals(double expected, double actual)
Returns the result ofassertNearlyEquals(double, double, double)
, withMisc.defaultMaxRelativeDiffDouble
.
-
assertNearlyEquals
public static void assertNearlyEquals(double expected, double actual, double maxRelDiff)
Same asassertNearlyEquals(float, float, float)
, but for doubles.
-
assertArrayNearlyEquals
public static void assertArrayNearlyEquals(float[] expecteds, float[] actuals)
Returns the result ofassertArrayNearlyEquals(float[], float[], float)
, withMisc.defaultMaxRelativeDiffFloat
.
-
assertArrayNearlyEquals
public static void assertArrayNearlyEquals(float[] expecteds, float[] actuals, float maxRelDiff)
Asserts that two float arrays are nearly equal by comparing analogous elements in the two arrays withMisc.nearlyEquals(float, float, float)
. If they are not, anAssertionError
is thrown.- Parameters:
expecteds
- float array with expected values.actuals
- float array with actual valuesmaxRelDiff
- the maximum relative difference that analogous array elements may have and still be considered equal.
-
assertArrayNearlyEquals
public static void assertArrayNearlyEquals(double[] expecteds, double[] actuals)
Returns the result ofassertArrayNearlyEquals(double[], double[], double)
, withMisc.defaultMaxRelativeDiffDouble
.
-
assertArrayNearlyEquals
public static void assertArrayNearlyEquals(double[] expecteds, double[] actuals, double maxRelDiff)
Same asassertArrayNearlyEquals(float[], float[], float)
, but for doubles.
-
-