analysis not terminating, looking for things that should equate but don't that preven...
authorjjenista <jjenista>
Fri, 19 Feb 2010 18:57:57 +0000 (18:57 +0000)
committerjjenista <jjenista>
Fri, 19 Feb 2010 18:57:57 +0000 (18:57 +0000)
Robust/src/Analysis/Disjoint/Canonical.java
Robust/src/Tests/disjoint/critical-regression-testing/makefile [new file with mode: 0644]
Robust/src/Tests/disjoint/critical-regression-testing/test.java [new file with mode: 0644]

index c5abe97490bc87c7b4cf6702574414b1562140ea..887a95f6504df6dd418a87089b5b0dcd22fea803 100644 (file)
@@ -7,6 +7,7 @@ import java.io.*;
 
 abstract public class Canonical {
 
+  // for generating unique canonical values
   private static int canonicalCount = 1;
 
   // the canon of objects
@@ -16,9 +17,12 @@ abstract public class Canonical {
 
 
   public static Canonical makeCanonical( Canonical c ) {
-    if( canon.containsKey( c ) ) {
+
+    if( c.isCanonical() ) {
+      assert canon.containsKey( c );
       return canon.get( c );
     }
+    
     c.canonicalValue = canonicalCount;
     ++canonicalCount;
     canon.put( c, c );
diff --git a/Robust/src/Tests/disjoint/critical-regression-testing/makefile b/Robust/src/Tests/disjoint/critical-regression-testing/makefile
new file mode 100644 (file)
index 0000000..a3b6091
--- /dev/null
@@ -0,0 +1,14 @@
+PROGRAM=test
+
+SOURCE_FILES=$(PROGRAM).java
+
+all:
+       javac -Xlint:unchecked -classpath ../../.. $(SOURCE_FILES)
+
+run:
+       java -classpath .:../../.. $(PROGRAM)
+
+
+clean:
+       rm -f  *.class
+       rm -f  *~
diff --git a/Robust/src/Tests/disjoint/critical-regression-testing/test.java b/Robust/src/Tests/disjoint/critical-regression-testing/test.java
new file mode 100644 (file)
index 0000000..e8b6c21
--- /dev/null
@@ -0,0 +1,49 @@
+import IR.*;
+import IR.Flat.*;
+import java.util.*;
+import java.io.*;
+import Analysis.Disjoint.*;
+
+
+public class test {
+
+  static public void main( String[] args ) {
+    test t = new test();
+    t.execTests();
+  }
+
+  void execTests() {
+    System.out.println( "Testing components of disjoint reachability analysis..." );
+    t1();
+    t2();
+    System.out.println( "Testing completed successfully." );    
+  }
+
+  void t1() {
+    ReachTuple rt11a = ReachTuple.factory( 11, true, ReachTuple.ARITY_ONE );
+    ReachTuple rt11b = ReachTuple.factory( 11, true, ReachTuple.ARITY_ONE );
+    ReachTuple rt12  = ReachTuple.factory( 12, true, ReachTuple.ARITY_ONE );
+    ReachTuple rt12z = ReachTuple.factory( 12, true, ReachTuple.ARITY_ZEROORMORE );
+    ReachTuple rt13  = ReachTuple.factory( 13, false, ReachTuple.ARITY_ONE );
+
+    assert rt11a.equals( rt11b );
+    assert rt11b.equals( rt11a );
+    assert rt11a == rt11b;
+    assert !rt11a.equals( rt12 );
+    assert !rt12.equals( rt11b );
+    
+    assert Canonical.unionArity( rt11a, rt11b ).isCanonical();
+    assert Canonical.unionArity( rt11a, rt11b ).getArity() == ReachTuple.ARITY_ZEROORMORE;
+
+    assert Canonical.unionArity( rt12, rt12z ).isCanonical();
+    assert Canonical.unionArity( rt12, rt12z ).getArity() == ReachTuple.ARITY_ZEROORMORE;
+
+    assert Canonical.unionArity( rt13, rt13 ).isCanonical();
+    assert Canonical.unionArity( rt13, rt13 ).getArity() == ReachTuple.ARITY_ONE;
+  }
+
+  void t2() {
+    
+  }
+
+}