/** * Asserts that two floats are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ public static void assertEquals(String message, float expected, float actual, float delta) { if (floatIsDifferent(expected, actual, delta)) { failNotEquals(message, Float.valueOf(expected), Float.valueOf(actual)); } }
/** * Asserts that two floats are <b>not</b> equal to within a positive delta. * If they are, an {@link AssertionError} is thrown with the given * message. If the unexpected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertNotEquals(Float.NaN, Float.NaN, *)</code> fails * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param unexpected unexpected value * @param actual the value to check against <code>unexpected</code> * @param delta the maximum delta between <code>unexpected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ public static void assertNotEquals(String message, float unexpected, float actual, float delta) { if (!floatIsDifferent(unexpected, actual, delta)) { failEquals(message, actual); } }
/** * Asserts that two floats are <b>not</b> equal to within a positive delta. * If they are, an {@link AssertionError} is thrown with the given * message. If the unexpected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertNotEquals(Float.NaN, Float.NaN, *)</code> fails * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param unexpected unexpected value * @param actual the value to check against <code>unexpected</code> * @param delta the maximum delta between <code>unexpected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertNotEquals(String message, float unexpected, float actual, float delta) { if (!floatIsDifferent(unexpected, actual, delta)) { failEquals(message, Float.valueOf(actual)); } }
/** * Asserts that two floats are <b>not</b> equal to within a positive delta. * If they are, an {@link AssertionError} is thrown with the given * message. If the unexpected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertNotEquals(Float.NaN, Float.NaN, *)</code> fails * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param unexpected unexpected value * @param actual the value to check against <code>unexpected</code> * @param delta the maximum delta between <code>unexpected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertNotEquals(String message, float unexpected, float actual, float delta) { if (!floatIsDifferent(unexpected, actual, delta)) { failEquals(message, Float.valueOf(actual)); } }
/** * Asserts that two floats are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertEquals(String message, float expected, float actual, float delta) { if (floatIsDifferent(expected, actual, delta)) { failNotEquals(message, Float.valueOf(expected), Float.valueOf(actual)); } }
/** * Asserts that two floats are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertEquals(String message, float expected, float actual, float delta) { if (floatIsDifferent(expected, actual, delta)) { failNotEquals(message, Float.valueOf(expected), Float.valueOf(actual)); } }