fenfire-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ff-cvs] fenfire/org/fenfire/functional FunctionalTest.j...


From: Tuomas J. Lukka
Subject: [ff-cvs] fenfire/org/fenfire/functional FunctionalTest.j...
Date: Mon, 15 Sep 2003 13:34:44 -0400

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Branch:         
Changes by:     Tuomas J. Lukka <address@hidden>        03/09/15 13:34:44

Modified files:
        org/fenfire/functional: FunctionalTest.java 
                                SuperFunctional1.java 
                                superfunctional1.test 

Log message:
        Arch sync

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/functional/FunctionalTest.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/functional/SuperFunctional1.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/functional/superfunctional1.test.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: fenfire/org/fenfire/functional/FunctionalTest.java
diff -u fenfire/org/fenfire/functional/FunctionalTest.java:1.1 
fenfire/org/fenfire/functional/FunctionalTest.java:1.2
--- fenfire/org/fenfire/functional/FunctionalTest.java:1.1      Wed Sep 10 
09:00:46 2003
+++ fenfire/org/fenfire/functional/FunctionalTest.java  Mon Sep 15 13:34:44 2003
@@ -105,5 +105,17 @@
            return res;
        }
     }
+
+    /** An identity node function.
+     */
+    static public class Identity_Node implements PureNodeFunction {
+       NodeFunction f;
+       public Identity_Node(NodeFunction f) {
+           this.f = f;
+       }
+       public Object f(ConstGraph g, Object o) {
+           return f.f(g, o);
+       }
+    }
 }
 
Index: fenfire/org/fenfire/functional/SuperFunctional1.java
diff -u fenfire/org/fenfire/functional/SuperFunctional1.java:1.2 
fenfire/org/fenfire/functional/SuperFunctional1.java:1.3
--- fenfire/org/fenfire/functional/SuperFunctional1.java:1.2    Thu Sep 11 
13:26:08 2003
+++ fenfire/org/fenfire/functional/SuperFunctional1.java        Mon Sep 15 
13:34:44 2003
@@ -253,14 +253,15 @@
                }
                public void triggerObs() {
                    if(closed)  {
-                       throw new Error("triggerObs closed entry");
+                       // Do nothing - it's legal to trigger obses in 
+                       // closed entries
                    }
                    super.triggerObs();
                }
                public void chg() {
                    if(closed)  {
-                       p("chg closed entry");
-                       return;
+                       // Do nothing - it's legal to trigger obses in 
+                       // closed entries
                    }
                    super.chg();
                }
Index: fenfire/org/fenfire/functional/superfunctional1.test
diff -u fenfire/org/fenfire/functional/superfunctional1.test:1.1 
fenfire/org/fenfire/functional/superfunctional1.test:1.2
--- fenfire/org/fenfire/functional/superfunctional1.test:1.1    Wed Sep 10 
09:00:46 2003
+++ fenfire/org/fenfire/functional/superfunctional1.test        Mon Sep 15 
13:34:44 2003
@@ -143,4 +143,44 @@
     seteq( f.f(nodes[0]) , [nodes[3]] )
 
 
+def testSuperlazy3_doublecache_chg():
+    """Test that a double cache works right.
+
+    There used to be a bug where the entries in the smaller cache
+    didn't chg() to the lower cache correctly.
+    """
+    background = vob.util.ExplicitBackground()
+    graph = ff.swamp.impl.HashGraph()
+    functional = ff.functional.SuperFunctional1(graph, background)
+
+    # Two normal caches
+    functional.cache("A", 2, 0)
+    functional.cache("B", 100, 0)
+
+    nodes = [ff.swamp.Nodes.N() for i in range(0,10)]
+
+    node = functional.createFunctionInstance(
+           "A",
+           ff.functional.FunctionalTest.TripleSet_Node,
+           [ nodes[1] ]
+           )
+    node = functional.createFunctionInstance(
+           "B",
+           ff.functional.FunctionalTest.Identity_Node,
+           [ node ]
+           )
+    f = node.getCallableFunction()
+
+    # The latest one has to be the one to move
+    for i in range(2, 7):
+       seteq( f.f(nodes[i]) , [] )
+
+    for i in range(2, 7):
+       graph.add(nodes[i], nodes[1], nodes[0])
+
+    for i in range(2, 7):
+       seteq( f.f(nodes[i]) , [nodes[0]] )
+
+
+
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]