[pypy-commit] pypy default: Add a test (passing at least on C compilers with _Bool)

arigo noreply at buildbot.pypy.org
Tue Jul 21 13:30:59 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
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


More information about the pypy-commit mailing list