Armin Rigo avatar Armin Rigo committed afa7003

Add 3 tests, 2 of which failing.

Comments (0)

Files changed (3)

pypy/rpython/test/test_rlist.py

                     res = self.interpret(fn, [i,j,case])
                     assert res is fn(i, j, case)
 
+    def test_list_compare_char_str(self):
+        def fn(i, j):
+            l1 = [str(i)]
+            l2 = [chr(j)]
+            return l1 == l2
+        res = self.interpret(fn, [65, 65])
+        assert res is False
+        res = self.interpret(fn, [1, 49])
+        assert res is True
+
 
     def test_list_compareinst(self):
         def fn(i, j, neg=False):

pypy/rpython/test/test_rstr.py

                                                         const('a')])
         assert res is False
 
+    def test_char_string_compare(self):
+        const = self.const
+        lst = [const('a'), const('abc')]
+        res = self.interpret(lambda i1, c2: (lst[i1],) == (c2,),
+                             [1, const('b')])
+        assert res is False
+        res = self.interpret(lambda i1, c2: (c2,) == (lst[i1],),
+                             [1, const('b')])
+        assert res is False
+
     def test_char_mul(self):
         const = self.const
         def fn(c, mul):

pypy/rpython/test/test_rtuple.py

         res = self.interpret(f, [53])
         assert res is True
 
+    def test_compare_list_char_str(self):
+        def fn(i, j):
+            t1 = ([str(i)],)
+            t2 = ([chr(j)],)
+            return t1 == t2
+        res = self.interpret(fn, [65, 65])
+        assert res is False
+        res = self.interpret(fn, [1, 49])
+        assert res is True
+
     TUPLES = [
         ((1,2),  (2,3),   -1),
         ((1,2),  (1,3),   -1),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.