[pypy-svn] r44092 - in pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Jun 7 15:30:25 CEST 2007


Author: cfbolz
Date: Thu Jun  7 15:30:24 2007
New Revision: 44092

Modified:
   pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/interpreter.py
   pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/test/test_arithmetic.py
   pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/test/test_builtin.py
Log:
ouch. forgot to restore the old continuation too :-(


Modified: pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/interpreter.py
==============================================================================
--- pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/interpreter.py	(original)
+++ pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/interpreter.py	Thu Jun  7 15:30:24 2007
@@ -115,6 +115,7 @@
                                 self = continuation.frame
                                 pc = continuation.pc
                                 bytecode = self.code.opcode
+                                continuation = continuation.continuation
                                 stack = []
                                 break
                             else:
@@ -202,7 +203,6 @@
                     return
                 except error.UnificationFailed:
                     self.engine.heap.revert(oldstate)
-            rule = rulechain.rule
             rulechain = rulechain.next
         raise error.UnificationFailed
 

Modified: pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/test/test_arithmetic.py
==============================================================================
--- pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/test/test_arithmetic.py	(original)
+++ pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/test/test_arithmetic.py	Thu Jun  7 15:30:24 2007
@@ -101,3 +101,11 @@
     assert_false("1 > 1.")
     assert_false("1 =\\= 1.0.")
     assert_true("1 =\\= 32.")
+
+def test_countdown():
+    e = get_engine("""
+        f(0).
+        f(X) :- Y is X - 1, f(Y).
+    """)
+    assert_true("f(100).", e)
+ 

Modified: pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/test/test_builtin.py
==============================================================================
--- pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/test/test_builtin.py	(original)
+++ pypy/branch/prolog-bytecode/pypy/lang/prolog/interpreter/test/test_builtin.py	Thu Jun  7 15:30:24 2007
@@ -193,7 +193,7 @@
         f(X) :- Y is X - 1, !, f(Y).
         f(X) :- Y is X - 2, !, f(Y).
     """)
-    assert_true("f(20).", e)
+    assert_true("f(10).", e)
 
 def test_call_cut():
     e = get_engine("""



More information about the Pypy-commit mailing list