Armin Rigo avatar Armin Rigo committed 6ce870a

New test, showing the slightly weird behavior of 'and' (see control flow
graph).

Comments (0)

Files changed (2)

pypy/translator/test/snippet.py

         ptr += 1
         bitmask += 1
     return powerset
+
+def s_and(x, y):
+    if x and y:
+        return 'yes'
+    else:
+        return 'no'

pypy/translator/test/test_pyrextrans.py

         half = self.build_cfunc(t.half_of_n)
         self.assertEquals(half(10), 5)
 
+    def test_and(self):
+        sand = self.build_cfunc(t.s_and)
+        self.assertEquals(sand(5, 6), "yes")
+        self.assertEquals(sand(5, 0), "no")
+        self.assertEquals(sand(0, 6), "no")
+        self.assertEquals(sand(0, 0), "no")
+
 class NoTypePyrexGenTestCase(TypedPyrexGenTestCase):
 
     def build_cfunc(self, func):
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.