[pypy-commit] creflect default: next test
arigo
noreply at buildbot.pypy.org
Fri Dec 19 17:10:08 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r203:2cd634f7b816
Date: 2014-12-19 15:11 +0100
http://bitbucket.org/cffi/creflect/changeset/2cd634f7b816/
Log: next test
diff --git a/zeffir/cdata.c b/zeffir/cdata.c
--- a/zeffir/cdata.c
+++ b/zeffir/cdata.c
@@ -947,10 +947,9 @@
PyObject *result, *s;
if (cd->c_type->ct_flags & CT_PRIMITIVE_ANY) {
- abort();//XXX
-#if 0
if (cd->c_type->ct_flags & CT_IS_ENUM) {
- s = convert_cdata_to_enum_string(cd, 1);
+ abort();
+ //XXX s = convert_cdata_to_enum_string(cd, 1);
}
else if (cd->c_type->ct_flags & CT_IS_LONGDOUBLE) {
long double lvalue;
@@ -967,7 +966,6 @@
s = PyObject_Repr(o);
Py_DECREF(o);
}
-#endif
}
else if ((cd->c_type->ct_flags & CT_ARRAY) && cd->c_type->ct_length < 0) {
s = PyString_FromFormat("sliced length %zd", get_array_length(cd));
diff --git a/zeffir/test/test_c.py b/zeffir/test/test_c.py
--- a/zeffir/test/test_c.py
+++ b/zeffir/test/test_c.py
@@ -55,3 +55,18 @@
assert p.kind == "primitive"
assert p.cname == "signed char"
check_dir(p, ['cname', 'kind'])
+
+def test_cast_to_signed_char():
+ ffi = support.new_ffi()
+ t = ffi.typeof("signed char")
+ x = ffi.cast(t, -65 + 17*256)
+ assert repr(x) == "<cdata 'signed char' -65>"
+ assert repr(type(x)) == "<%s 'zeffir.CData'>" % type_or_class
+ assert int(x) == -65
+ x = ffi.cast(t, -66 + (1<<199)*256)
+ assert repr(x) == "<cdata 'signed char' -66>"
+ assert int(x) == -66
+ assert (x == ffi.cast(t, -66)) is False
+ assert (x != ffi.cast(t, -66)) is True
+ assert (x == ffi.cast("short", -66)) is False
+ assert (x != ffi.cast("short", -66)) is True
More information about the pypy-commit
mailing list