use of java.math.RoundingMode in project guava by hceylan.
the class LongMathTest method testLog10ZeroAlwaysThrows.
public void testLog10ZeroAlwaysThrows() {
for (RoundingMode mode : ALL_ROUNDING_MODES) {
try {
LongMath.log10(0L, mode);
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
}
}
use of java.math.RoundingMode in project guava by hceylan.
the class LongMathTest method testLog2NegativeAlwaysThrows.
public void testLog2NegativeAlwaysThrows() {
for (long x : NEGATIVE_LONG_CANDIDATES) {
for (RoundingMode mode : ALL_ROUNDING_MODES) {
try {
LongMath.log2(x, mode);
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
}
}
}
use of java.math.RoundingMode in project guava by hceylan.
the class BigIntegerMathTest method testLog2Floor.
public void testLog2Floor() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
for (RoundingMode mode : asList(FLOOR, DOWN)) {
int result = BigIntegerMath.log2(x, mode);
assertTrue(ZERO.setBit(result).compareTo(x) <= 0);
assertTrue(ZERO.setBit(result + 1).compareTo(x) > 0);
}
}
}
use of java.math.RoundingMode in project guava by hceylan.
the class BigIntegerMathTest method testSqrtNegativeAlwaysThrows.
public void testSqrtNegativeAlwaysThrows() {
for (BigInteger x : NEGATIVE_BIGINTEGER_CANDIDATES) {
for (RoundingMode mode : ALL_ROUNDING_MODES) {
try {
BigIntegerMath.sqrt(x, mode);
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
}
}
}
use of java.math.RoundingMode in project guava by hceylan.
the class BigIntegerMathTest method testLog10NegativeAlwaysThrows.
public void testLog10NegativeAlwaysThrows() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
for (RoundingMode mode : ALL_ROUNDING_MODES) {
try {
BigIntegerMath.log10(x.negate(), mode);
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
}
}
}
Aggregations