[pypy-commit] pypy default: Update to cffi/231fd7f12dbb.
arigo
noreply at buildbot.pypy.org
Sat Mar 30 18:37:22 CET 2013
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r62892:1dee64abca8b
Date: 2013-03-30 18:37 +0100
http://bitbucket.org/pypy/pypy/changeset/1dee64abca8b/
Log: Update to cffi/231fd7f12dbb.
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -2277,6 +2277,7 @@
def test_longdouble():
py_py = 'PY_DOT_PY' in globals()
+ BInt = new_primitive_type("int")
BLongDouble = new_primitive_type("long double")
BLongDoublePtr = new_pointer_type(BLongDouble)
BLongDoubleArray = new_array_type(BLongDoublePtr, None)
@@ -2294,21 +2295,23 @@
assert float(x) == 1.23
assert int(x) == 1
#
- BFunc19 = new_function_type((BLongDouble,), BLongDouble)
+ BFunc19 = new_function_type((BLongDouble, BInt), BLongDouble)
f = cast(BFunc19, _testfunc(19))
- start = 8
+ start = lstart = 1.5
for i in range(107):
- start = f(start)
- if sizeof(BLongDouble) > sizeof(new_primitive_type("double")):
- if not py_py:
- assert repr(start).startswith("<cdata 'long double' 6.15")
- assert repr(start).endswith("E+902>")
- #
- c = newp(BLongDoubleArray, [start])
- x = c[0]
- if not py_py:
- assert repr(x).endswith("E+902>")
- assert float(x) == float("inf")
+ start = 4 * start - start * start
+ lstart = f(lstart, 1)
+ lother = f(1.5, 107)
+ if not py_py:
+ assert float(lstart) == float(lother)
+ assert repr(lstart) == repr(lother)
+ if sizeof(BLongDouble) > sizeof(new_primitive_type("double")):
+ assert float(lstart) != start
+ assert repr(lstart).startswith("<cdata 'long double' ")
+ #
+ c = newp(BLongDoubleArray, [lstart])
+ x = c[0]
+ assert float(f(lstart, 107)) == float(f(x, 107))
def test_get_array_of_length_zero():
for length in [0, 5, 10]:
diff --git a/pypy/module/_cffi_backend/test/_test_lib.c b/pypy/module/_cffi_backend/test/_test_lib.c
--- a/pypy/module/_cffi_backend/test/_test_lib.c
+++ b/pypy/module/_cffi_backend/test/_test_lib.c
@@ -133,11 +133,12 @@
return ptr->a1 + (int)ptr->a2;
}
-static long double _testfunc19(long double x)
+static long double _testfunc19(long double x, int count)
{
int i;
- for (i=0; i<28; i++)
- x += x;
+ for (i=0; i<count; i++) {
+ x = 4*x - x*x;
+ }
return x;
}
More information about the pypy-commit
mailing list