Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r78622:ff0ebb4b3a7d
Date: 2015-07-21 12:22 +0200
http://bitbucket.org/pypy/pypy/changeset/ff0ebb4b3a7d/

Log:    Add a test (passing at least on C compilers with _Bool)

diff --git a/rpython/translator/c/test/test_lltyped.py 
b/rpython/translator/c/test/test_lltyped.py
--- a/rpython/translator/c/test/test_lltyped.py
+++ b/rpython/translator/c/test/test_lltyped.py
@@ -981,3 +981,13 @@
         assert fn(0) == 3
         assert fn(10) == 42
         assert fn(100) == -10
+
+    def test_cast_to_bool(self):
+        def f(n):
+            return rffi.cast(Bool, n)
+
+        fn = self.getcompiled(f, [int])
+        assert fn(0) == False
+        assert fn(1) == True
+        assert fn(256) == True
+        assert fn(-2**24) == True
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to