[pypy-svn] r48713 - in pypy/branch/ropes-unicode/pypy/objspace/std: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Nov 15 18:05:33 CET 2007


Author: cfbolz
Date: Thu Nov 15 18:05:33 2007
New Revision: 48713

Modified:
   pypy/branch/ropes-unicode/pypy/objspace/std/rope.py
   pypy/branch/ropes-unicode/pypy/objspace/std/test/test_rope.py
Log:
off by one error – all tests pass


Modified: pypy/branch/ropes-unicode/pypy/objspace/std/rope.py
==============================================================================
--- pypy/branch/ropes-unicode/pypy/objspace/std/rope.py	(original)
+++ pypy/branch/ropes-unicode/pypy/objspace/std/rope.py	Thu Nov 15 18:05:33 2007
@@ -760,7 +760,7 @@
         elif j>0:
             new_j = restart[j-1]
             assert new_j < j
-            iter2.seekback(j - new_j)
+            iter2.seekback(j - new_j + 1)
             c2 = iter2.nextint()
             j = new_j
         else:

Modified: pypy/branch/ropes-unicode/pypy/objspace/std/test/test_rope.py
==============================================================================
--- pypy/branch/ropes-unicode/pypy/objspace/std/test/test_rope.py	(original)
+++ pypy/branch/ropes-unicode/pypy/objspace/std/test/test_rope.py	Thu Nov 15 18:05:33 2007
@@ -317,6 +317,17 @@
     assert restart == [0, 0, 1, 2, 0, 1, 2, 3, 4]
     restart = construct_restart_positions("ababcabab")
     assert restart == [0, 0, 1, 2, 0, 1, 2, 3, 4]
+    restart = construct_restart_positions("ababcababb")
+    assert restart == [0, 0, 1, 2, 0, 1, 2, 3, 4, 0]
+    restart = construct_restart_positions_node(
+        BinaryConcatNode(LiteralStringNode("aba"), LiteralStringNode("bcababb")))
+    assert restart == [0, 0, 1, 2, 0, 1, 2, 3, 4, 0]
+    restart = construct_restart_positions("ababb")
+    assert restart == [0, 0, 1, 2, 0]
+    restart = construct_restart_positions_node(LiteralStringNode("ababb"))
+    assert restart == [0, 0, 1, 2, 0]
+    #abababcabcabb
+
 
 def test_find():
     node = BinaryConcatNode(LiteralStringNode("aba"),



More information about the Pypy-commit mailing list