org.junit.Assert.floatIsDifferent()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中org.junit.Assert.floatIsDifferent()方法的一些代码示例,展示了Assert.floatIsDifferent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.floatIsDifferent()方法的具体详情如下:
包路径:org.junit.Assert
类名称:Assert
方法名:floatIsDifferent

Assert.floatIsDifferent介绍

暂无

代码示例

代码示例来源:origin: junit-team/junit4

/**
 * 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));
  }
}

代码示例来源:origin: junit-team/junit4

/**
 * 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);
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * 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));
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.junit

/**
 * 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));
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * 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));
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.junit

/**
 * 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));
  }
}

相关文章