[pypy-commit] creflect default: the next tests to pass
arigo
noreply at buildbot.pypy.org
Fri Dec 5 12:43:17 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r160:adbaf54b8357
Date: 2014-12-05 12:43 +0100
http://bitbucket.org/cffi/creflect/changeset/adbaf54b8357/
Log: the next tests to pass
diff --git a/zeffir/cfunc.c b/zeffir/cfunc.c
--- a/zeffir/cfunc.c
+++ b/zeffir/cfunc.c
@@ -48,7 +48,8 @@
actualnargs = PyTuple_Size(args);
if (actualnargs != nargs) {
if (!PyErr_Occurred())
- PyErr_Format(PyExc_TypeError, "'%s' expects %d arguments, got %zd",
+ PyErr_Format(PyExc_TypeError,
+ "'%s()' expected %d arguments, but got %zd",
zfs->zfs_funcname, nargs, actualnargs);
return NULL;
}
diff --git a/zeffir/test/function.crx b/zeffir/test/function.crx
--- a/zeffir/test/function.crx
+++ b/zeffir/test/function.crx
@@ -3,9 +3,18 @@
return x + 1;
}
+int add_from_array(int array[], int count)
+{
+ int result = 0;
+ while (count > 0)
+ result += array[--count];
+ return result;
+}
+
// CREFLECT: start
int simple_function(int);
+int add_from_array(int array[], int count);
// CREFLECT: end
diff --git a/zeffir/test/test_function.py b/zeffir/test/test_function.py
--- a/zeffir/test/test_function.py
+++ b/zeffir/test/test_function.py
@@ -1,3 +1,4 @@
+import py
import support
@@ -6,3 +7,18 @@
res = lib.simple_function(42)
assert type(res) is int
assert res == 43
+
+def test_function_with_pointer_arg():
+ py.test.skip("in-progress")
+ ffi, lib = support.compile_and_open('function')
+ p = ffi.new("int[]", [30, 2, 10])
+ res = lib.add_from_array(p, 3)
+ assert type(res) is int
+ assert res == 42
+
+def test_function_with_array_arg():
+ py.test.skip("in-progress")
+ ffi, lib = support.compile_and_open('function')
+ res = lib.add_from_array([30, 2, 10], 3)
+ assert type(res) is int
+ assert res == 42
More information about the pypy-commit
mailing list