Author: Armin Rigo <[email protected]>
Branch: fix-2198
Changeset: r81384:8db9bd041275
Date: 2015-12-18 20:27 +0100
http://bitbucket.org/pypy/pypy/changeset/8db9bd041275/

Log:    Two tests for the two cases of ll_listsetslice() which resizes the
        lists. Both fail :-(

diff --git a/rpython/rtyper/test/test_rlist.py 
b/rpython/rtyper/test/test_rlist.py
--- a/rpython/rtyper/test/test_rlist.py
+++ b/rpython/rtyper/test/test_rlist.py
@@ -136,6 +136,27 @@
                 del expected[start:stop]
                 self.check_list(l, expected)
 
+    def test_rlist_setslice_resizing(self):
+        for start in range(5):
+            for stop in range(start, 5):
+                for len2 in range(5):
+                    l1 = self.sample_list()    # [42, 43, 44, 45]
+                    l2 = self.sample_list()
+                    ll_listdelslice_startonly(l2, len2)   # initial slice
+                    ll_listsetslice(l1, start, stop, l2)
+                    expected = [42, 43, 44, 45]
+                    expected[start:stop] = [42, 43, 44, 45][:len2]
+                    self.check_list(l1, expected)
+
+    def test_rlist_setslice_overlapping(self):
+        for start in range(5):
+            for stop in range(start, 5):
+                l1 = self.sample_list()    # [42, 43, 44, 45]
+                ll_listsetslice(l1, start, stop, l1)    # l1 twice!
+                expected = [42, 43, 44, 45]
+                expected[start:stop] = [42, 43, 44, 45]
+                self.check_list(l1, expected)
+
 
 class TestFixedSizeListImpl(BaseTestListImpl):
     def sample_list(self):    # [42, 43, 44, 45]
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to