|
|
|
@ -775,188 +775,189 @@ public class NumberUtilsTest extends TestCase {
|
|
|
|
|
assertEquals(high, NumberUtils.max(high, mid, high), 0.0001f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Testing JDK against old Lang functionality
|
|
|
|
|
public void testCompareDouble() {
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NaN, Double.NaN) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NaN, Double.POSITIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NaN, Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NaN, 1.2d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NaN, 0.0d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NaN, -0.0d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NaN, -1.2d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NaN, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NaN, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.NaN, Double.NaN) == 0);
|
|
|
|
|
assertTrue(Double.compare(Double.NaN, Double.POSITIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.NaN, Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.NaN, 1.2d) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.NaN, 0.0d) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.NaN, -0.0d) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.NaN, -1.2d) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.NaN, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.NaN, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, Double.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, 1.2d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, 0.0d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, -0.0d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, -1.2d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.POSITIVE_INFINITY, Double.NaN) == -1);
|
|
|
|
|
assertTrue(Double.compare(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY) == 0);
|
|
|
|
|
assertTrue(Double.compare(Double.POSITIVE_INFINITY, Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.POSITIVE_INFINITY, 1.2d) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.POSITIVE_INFINITY, 0.0d) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.POSITIVE_INFINITY, -0.0d) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.POSITIVE_INFINITY, -1.2d) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.POSITIVE_INFINITY, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.MAX_VALUE, Double.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.MAX_VALUE, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.MAX_VALUE, Double.MAX_VALUE) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.MAX_VALUE, 1.2d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.MAX_VALUE, 0.0d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.MAX_VALUE, -0.0d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.MAX_VALUE, -1.2d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.MAX_VALUE, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.MAX_VALUE, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.MAX_VALUE, Double.NaN) == -1);
|
|
|
|
|
assertTrue(Double.compare(Double.MAX_VALUE, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Double.compare(Double.MAX_VALUE, Double.MAX_VALUE) == 0);
|
|
|
|
|
assertTrue(Double.compare(Double.MAX_VALUE, 1.2d) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.MAX_VALUE, 0.0d) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.MAX_VALUE, -0.0d) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.MAX_VALUE, -1.2d) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.MAX_VALUE, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Double.compare(Double.MAX_VALUE, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2d, Double.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2d, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2d, Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2d, 1.2d) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2d, 0.0d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2d, -0.0d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2d, -1.2d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2d, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2d, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Double.compare(1.2d, Double.NaN) == -1);
|
|
|
|
|
assertTrue(Double.compare(1.2d, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Double.compare(1.2d, Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Double.compare(1.2d, 1.2d) == 0);
|
|
|
|
|
assertTrue(Double.compare(1.2d, 0.0d) == +1);
|
|
|
|
|
assertTrue(Double.compare(1.2d, -0.0d) == +1);
|
|
|
|
|
assertTrue(Double.compare(1.2d, -1.2d) == +1);
|
|
|
|
|
assertTrue(Double.compare(1.2d, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Double.compare(1.2d, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0d, Double.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0d, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0d, Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0d, 1.2d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0d, 0.0d) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0d, -0.0d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0d, -1.2d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0d, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0d, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Double.compare(0.0d, Double.NaN) == -1);
|
|
|
|
|
assertTrue(Double.compare(0.0d, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Double.compare(0.0d, Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Double.compare(0.0d, 1.2d) == -1);
|
|
|
|
|
assertTrue(Double.compare(0.0d, 0.0d) == 0);
|
|
|
|
|
assertTrue(Double.compare(0.0d, -0.0d) == +1);
|
|
|
|
|
assertTrue(Double.compare(0.0d, -1.2d) == +1);
|
|
|
|
|
assertTrue(Double.compare(0.0d, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Double.compare(0.0d, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0d, Double.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0d, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0d, Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0d, 1.2d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0d, 0.0d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0d, -0.0d) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0d, -1.2d) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0d, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0d, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Double.compare(-0.0d, Double.NaN) == -1);
|
|
|
|
|
assertTrue(Double.compare(-0.0d, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Double.compare(-0.0d, Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Double.compare(-0.0d, 1.2d) == -1);
|
|
|
|
|
assertTrue(Double.compare(-0.0d, 0.0d) == -1);
|
|
|
|
|
assertTrue(Double.compare(-0.0d, -0.0d) == 0);
|
|
|
|
|
assertTrue(Double.compare(-0.0d, -1.2d) == +1);
|
|
|
|
|
assertTrue(Double.compare(-0.0d, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Double.compare(-0.0d, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2d, Double.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2d, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2d, Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2d, 1.2d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2d, 0.0d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2d, -0.0d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2d, -1.2d) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2d, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2d, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Double.compare(-1.2d, Double.NaN) == -1);
|
|
|
|
|
assertTrue(Double.compare(-1.2d, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Double.compare(-1.2d, Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Double.compare(-1.2d, 1.2d) == -1);
|
|
|
|
|
assertTrue(Double.compare(-1.2d, 0.0d) == -1);
|
|
|
|
|
assertTrue(Double.compare(-1.2d, -0.0d) == -1);
|
|
|
|
|
assertTrue(Double.compare(-1.2d, -1.2d) == 0);
|
|
|
|
|
assertTrue(Double.compare(-1.2d, -Double.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Double.compare(-1.2d, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, Double.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, 1.2d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, 0.0d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, -0.0d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, -1.2d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, -Double.MAX_VALUE) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Double.compare(-Double.MAX_VALUE, Double.NaN) == -1);
|
|
|
|
|
assertTrue(Double.compare(-Double.MAX_VALUE, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Double.compare(-Double.MAX_VALUE, Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Double.compare(-Double.MAX_VALUE, 1.2d) == -1);
|
|
|
|
|
assertTrue(Double.compare(-Double.MAX_VALUE, 0.0d) == -1);
|
|
|
|
|
assertTrue(Double.compare(-Double.MAX_VALUE, -0.0d) == -1);
|
|
|
|
|
assertTrue(Double.compare(-Double.MAX_VALUE, -1.2d) == -1);
|
|
|
|
|
assertTrue(Double.compare(-Double.MAX_VALUE, -Double.MAX_VALUE) == 0);
|
|
|
|
|
assertTrue(Double.compare(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, Double.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, 1.2d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, 0.0d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, -0.0d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, -1.2d) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, -Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY) == 0);
|
|
|
|
|
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, Double.NaN) == -1);
|
|
|
|
|
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, 1.2d) == -1);
|
|
|
|
|
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, 0.0d) == -1);
|
|
|
|
|
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, -0.0d) == -1);
|
|
|
|
|
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, -1.2d) == -1);
|
|
|
|
|
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, -Double.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY) == 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testCompareFloat() {
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NaN, Float.NaN) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NaN, Float.POSITIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NaN, Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NaN, 1.2f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NaN, 0.0f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NaN, -0.0f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NaN, -1.2f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NaN, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NaN, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.NaN, Float.NaN) == 0);
|
|
|
|
|
assertTrue(Float.compare(Float.NaN, Float.POSITIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.NaN, Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.NaN, 1.2f) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.NaN, 0.0f) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.NaN, -0.0f) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.NaN, -1.2f) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.NaN, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.NaN, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, Float.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, 1.2f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, 0.0f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, -0.0f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, -1.2f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.POSITIVE_INFINITY, Float.NaN) == -1);
|
|
|
|
|
assertTrue(Float.compare(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY) == 0);
|
|
|
|
|
assertTrue(Float.compare(Float.POSITIVE_INFINITY, Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.POSITIVE_INFINITY, 1.2f) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.POSITIVE_INFINITY, 0.0f) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.POSITIVE_INFINITY, -0.0f) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.POSITIVE_INFINITY, -1.2f) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.POSITIVE_INFINITY, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.MAX_VALUE, Float.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.MAX_VALUE, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.MAX_VALUE, Float.MAX_VALUE) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.MAX_VALUE, 1.2f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.MAX_VALUE, 0.0f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.MAX_VALUE, -0.0f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.MAX_VALUE, -1.2f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.MAX_VALUE, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.MAX_VALUE, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.MAX_VALUE, Float.NaN) == -1);
|
|
|
|
|
assertTrue(Float.compare(Float.MAX_VALUE, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Float.compare(Float.MAX_VALUE, Float.MAX_VALUE) == 0);
|
|
|
|
|
assertTrue(Float.compare(Float.MAX_VALUE, 1.2f) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.MAX_VALUE, 0.0f) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.MAX_VALUE, -0.0f) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.MAX_VALUE, -1.2f) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.MAX_VALUE, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Float.compare(Float.MAX_VALUE, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2f, Float.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2f, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2f, Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2f, 1.2f) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2f, 0.0f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2f, -0.0f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2f, -1.2f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2f, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(1.2f, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Float.compare(1.2f, Float.NaN) == -1);
|
|
|
|
|
assertTrue(Float.compare(1.2f, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Float.compare(1.2f, Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Float.compare(1.2f, 1.2f) == 0);
|
|
|
|
|
assertTrue(Float.compare(1.2f, 0.0f) == +1);
|
|
|
|
|
assertTrue(Float.compare(1.2f, -0.0f) == +1);
|
|
|
|
|
assertTrue(Float.compare(1.2f, -1.2f) == +1);
|
|
|
|
|
assertTrue(Float.compare(1.2f, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Float.compare(1.2f, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0f, Float.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0f, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0f, Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0f, 1.2f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0f, 0.0f) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0f, -0.0f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0f, -1.2f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0f, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(0.0f, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Float.compare(0.0f, Float.NaN) == -1);
|
|
|
|
|
assertTrue(Float.compare(0.0f, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Float.compare(0.0f, Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Float.compare(0.0f, 1.2f) == -1);
|
|
|
|
|
assertTrue(Float.compare(0.0f, 0.0f) == 0);
|
|
|
|
|
assertTrue(Float.compare(0.0f, -0.0f) == +1);
|
|
|
|
|
assertTrue(Float.compare(0.0f, -1.2f) == +1);
|
|
|
|
|
assertTrue(Float.compare(0.0f, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Float.compare(0.0f, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0f, Float.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0f, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0f, Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0f, 1.2f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0f, 0.0f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0f, -0.0f) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0f, -1.2f) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0f, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-0.0f, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Float.compare(-0.0f, Float.NaN) == -1);
|
|
|
|
|
assertTrue(Float.compare(-0.0f, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Float.compare(-0.0f, Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Float.compare(-0.0f, 1.2f) == -1);
|
|
|
|
|
assertTrue(Float.compare(-0.0f, 0.0f) == -1);
|
|
|
|
|
assertTrue(Float.compare(-0.0f, -0.0f) == 0);
|
|
|
|
|
assertTrue(Float.compare(-0.0f, -1.2f) == +1);
|
|
|
|
|
assertTrue(Float.compare(-0.0f, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Float.compare(-0.0f, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2f, Float.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2f, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2f, Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2f, 1.2f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2f, 0.0f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2f, -0.0f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2f, -1.2f) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2f, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-1.2f, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Float.compare(-1.2f, Float.NaN) == -1);
|
|
|
|
|
assertTrue(Float.compare(-1.2f, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Float.compare(-1.2f, Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Float.compare(-1.2f, 1.2f) == -1);
|
|
|
|
|
assertTrue(Float.compare(-1.2f, 0.0f) == -1);
|
|
|
|
|
assertTrue(Float.compare(-1.2f, -0.0f) == -1);
|
|
|
|
|
assertTrue(Float.compare(-1.2f, -1.2f) == 0);
|
|
|
|
|
assertTrue(Float.compare(-1.2f, -Float.MAX_VALUE) == +1);
|
|
|
|
|
assertTrue(Float.compare(-1.2f, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, Float.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, 1.2f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, 0.0f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, -0.0f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, -1.2f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, -Float.MAX_VALUE) == 0);
|
|
|
|
|
assertTrue(NumberUtils.compare(-Float.MAX_VALUE, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
assertTrue(Float.compare(-Float.MAX_VALUE, Float.NaN) == -1);
|
|
|
|
|
assertTrue(Float.compare(-Float.MAX_VALUE, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Float.compare(-Float.MAX_VALUE, Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Float.compare(-Float.MAX_VALUE, 1.2f) == -1);
|
|
|
|
|
assertTrue(Float.compare(-Float.MAX_VALUE, 0.0f) == -1);
|
|
|
|
|
assertTrue(Float.compare(-Float.MAX_VALUE, -0.0f) == -1);
|
|
|
|
|
assertTrue(Float.compare(-Float.MAX_VALUE, -1.2f) == -1);
|
|
|
|
|
assertTrue(Float.compare(-Float.MAX_VALUE, -Float.MAX_VALUE) == 0);
|
|
|
|
|
assertTrue(Float.compare(-Float.MAX_VALUE, Float.NEGATIVE_INFINITY) == +1);
|
|
|
|
|
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, Float.NaN) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, 1.2f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, 0.0f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, -0.0f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, -1.2f) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, -Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(NumberUtils.compare(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY) == 0);
|
|
|
|
|
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, Float.NaN) == -1);
|
|
|
|
|
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY) == -1);
|
|
|
|
|
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, 1.2f) == -1);
|
|
|
|
|
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, 0.0f) == -1);
|
|
|
|
|
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, -0.0f) == -1);
|
|
|
|
|
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, -1.2f) == -1);
|
|
|
|
|
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, -Float.MAX_VALUE) == -1);
|
|
|
|
|
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY) == 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testIsDigits() {
|
|
|
|
|