[pypy-commit] cffi default: Make the test more robust.

arigo noreply at buildbot.pypy.org
Sun Jun 24 18:19:38 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r505:42c220319de5
Date: 2012-06-24 18:17 +0200
http://bitbucket.org/cffi/cffi/changeset/42c220319de5/

Log:	Make the test more robust.

diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -215,9 +215,17 @@
     BChar = new_primitive_type("char")
     BInt = new_primitive_type("int")
     BFloat = new_primitive_type("float")
-    assert (hash(cast(BChar, 'A')) !=
-            hash(cast(BInt, 65)))
-    assert hash(cast(BFloat, 65)) != hash(65.0)
+    for i in range(1, 20):
+        if (hash(cast(BChar, chr(i))) !=
+            hash(cast(BInt, i))):
+            break
+    else:
+        raise AssertionError("hashes are equal")
+    for i in range(1, 20):
+        if hash(cast(BFloat, i)) != hash(float(i)):
+            break
+    else:
+        raise AssertionError("hashes are equal")
 
 def test_no_len_on_nonarray():
     p = new_primitive_type("int")


More information about the pypy-commit mailing list