changeset 11623:5d6ff483a5e9

Strengthen and simplify ConditionTest
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 11 Sep 2013 10:21:51 +0200
parents ccf047a30f18
children 3c2dc8364696
files graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionTest.java
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionTest.java	Fri Sep 13 13:02:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionTest.java	Wed Sep 11 10:21:51 2013 +0200
@@ -45,7 +45,7 @@
                         Constant b = Constant.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 && implies) {
+                        if (result1) {
                             assertTrue(result2);
                         }
                     }
@@ -60,7 +60,7 @@
         for (Condition c1 : Condition.values()) {
             for (Condition c2 : Condition.values()) {
                 Condition join = c1.join(c2);
-                assertTrue(join == c2.join(c1));
+                assertEquals(join, c2.join(c1));
                 if (join != null) {
                     for (int i = 0; i < 1000; i++) {
                         Constant a = Constant.forInt(rand.nextInt());
@@ -70,6 +70,8 @@
                         boolean resultJoin = join.foldCondition(a, b, null, false);
                         if (result1 && result2) {
                             assertTrue(resultJoin);
+                        } else {
+                            assertFalse(resultJoin);
                         }
                     }
                 }
@@ -83,7 +85,7 @@
         for (Condition c1 : Condition.values()) {
             for (Condition c2 : Condition.values()) {
                 Condition meet = c1.meet(c2);
-                assertTrue(meet == c2.meet(c1));
+                assertEquals(meet, c2.meet(c1));
                 if (meet != null) {
                     for (int i = 0; i < 1000; i++) {
                         Constant a = Constant.forInt(rand.nextInt());
@@ -93,6 +95,8 @@
                         boolean resultMeet = meet.foldCondition(a, b, null, false);
                         if (result1 || result2) {
                             assertTrue(resultMeet);
+                        } else {
+                            assertFalse(resultMeet);
                         }
                     }
                 }