use of org.graalvm.compiler.core.common.calc.Condition in project graal by oracle.
the class ConditionTest method testJoin.
@Test
public void testJoin() {
Random rand = new Random(13);
for (Condition c1 : Condition.values()) {
for (Condition c2 : Condition.values()) {
Condition join = c1.join(c2);
assertEquals(join, c2.join(c1));
if (join != null) {
for (int i = 0; i < 1000; i++) {
JavaConstant a = JavaConstant.forInt(rand.nextInt());
JavaConstant b = JavaConstant.forInt(i < 100 ? a.asInt() : rand.nextInt());
boolean result1 = c1.foldCondition(a, b, null, false);
boolean result2 = c2.foldCondition(a, b, null, false);
boolean resultJoin = join.foldCondition(a, b, null, false);
if (result1 && result2) {
assertTrue(resultJoin);
} else {
assertFalse(resultJoin);
}
}
}
}
}
}
use of org.graalvm.compiler.core.common.calc.Condition in project graal by oracle.
the class ConditionTest method testImplies.
@Test
public void testImplies() {
Random rand = new Random(13);
for (Condition c1 : Condition.values()) {
for (Condition c2 : Condition.values()) {
boolean implies = c1.implies(c2);
if (implies) {
for (int i = 0; i < 1000; i++) {
JavaConstant a = JavaConstant.forInt(rand.nextInt());
JavaConstant b = JavaConstant.forInt(i < 100 ? a.asInt() : rand.nextInt());
boolean result1 = c1.foldCondition(a, b, null, false);
boolean result2 = c2.foldCondition(a, b, null, false);
if (result1) {
assertTrue(result2);
}
}
}
}
}
}
Aggregations