summaryrefslogtreecommitdiff
path: root/testing/test_function.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2012-06-14 16:32:50 +0200
committerArmin Rigo <arigo@tunes.org>2012-06-14 16:32:50 +0200
commit6c9f8f748c0c32175eaf199ea8cacfac80dfd2cb (patch)
treedd6722f6600a3aa842b06b4449fb54553788738c /testing/test_function.py
parent468c3970461dd7adfab2ae589f5671d6f301b49f (diff)
downloadcffi-6c9f8f748c0c32175eaf199ea8cacfac80dfd2cb.tar.gz
Rename ffi.rawload() to ffi.dlopen().
Diffstat (limited to 'testing/test_function.py')
-rw-r--r--testing/test_function.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/testing/test_function.py b/testing/test_function.py
index fa70166..0e5a733 100644
--- a/testing/test_function.py
+++ b/testing/test_function.py
@@ -36,7 +36,7 @@ class TestFunction(object):
ffi.cdef("""
double sin(double x);
""")
- m = ffi.rawload("m")
+ m = ffi.dlopen("m")
x = m.sin(1.23)
assert x == math.sin(1.23)
@@ -45,7 +45,7 @@ class TestFunction(object):
ffi.cdef("""
float sinf(float x);
""")
- m = ffi.rawload("m")
+ m = ffi.dlopen("m")
x = m.sinf(1.23)
assert type(x) is float
assert x != math.sin(1.23) # rounding effects
@@ -57,7 +57,7 @@ class TestFunction(object):
int puts(const char *);
int fflush(void *);
""")
- ffi.C = ffi.rawload(None)
+ ffi.C = ffi.dlopen(None)
ffi.C.puts # fetch before capturing, for easier debugging
with FdWriteCapture() as fd:
ffi.C.puts("hello")
@@ -72,7 +72,7 @@ class TestFunction(object):
int puts(char *);
int fflush(void *);
""")
- ffi.C = ffi.rawload(None)
+ ffi.C = ffi.dlopen(None)
ffi.C.puts # fetch before capturing, for easier debugging
with FdWriteCapture() as fd:
ffi.C.puts("hello")
@@ -87,7 +87,7 @@ class TestFunction(object):
int fputs(const char *, void *);
void *stdout, *stderr;
""")
- ffi.C = ffi.rawload(None)
+ ffi.C = ffi.dlopen(None)
with FdWriteCapture(2) as fd:
ffi.C.fputs("hello from stderr\n", ffi.C.stderr)
res = fd.getvalue()
@@ -99,7 +99,7 @@ class TestFunction(object):
int printf(const char *format, ...);
int fflush(void *);
""")
- ffi.C = ffi.rawload(None)
+ ffi.C = ffi.dlopen(None)
with FdWriteCapture() as fd:
ffi.C.printf("hello with no arguments\n")
ffi.C.printf("hello, %s!\n", ffi.new("char[]", "world"))
@@ -123,7 +123,7 @@ class TestFunction(object):
ffi.cdef("""
int printf(const char *format, ...);
""")
- ffi.C = ffi.rawload(None)
+ ffi.C = ffi.dlopen(None)
e = py.test.raises(TypeError, ffi.C.printf, "hello %d\n", 42)
assert str(e.value) == ("argument 2 passed in the variadic part "
"needs to be a cdata object (got int)")
@@ -133,7 +133,7 @@ class TestFunction(object):
ffi.cdef("""
int puts(const char *);
""")
- ffi.C = ffi.rawload(None)
+ ffi.C = ffi.dlopen(None)
fptr = ffi.C.puts
assert ffi.typeof(fptr) == ffi.typeof("int(*)(const char*)")
if self.Backend is CTypesBackend:
@@ -154,7 +154,7 @@ class TestFunction(object):
int puts(const char *);
int fflush(void *);
""")
- ffi.C = ffi.rawload(None)
+ ffi.C = ffi.dlopen(None)
fptr = ffi.cast("int(*)(const char *txt)", ffi.C.puts)
assert fptr == ffi.C.puts
assert repr(fptr) == "<cdata 'int(*)(char *)'>"
@@ -169,7 +169,7 @@ class TestFunction(object):
ffi.cdef("""
int strlen(char[]);
""")
- ffi.C = ffi.rawload(None)
+ ffi.C = ffi.dlopen(None)
p = ffi.new("char[]", "hello")
res = ffi.C.strlen(p)
assert res == 5
@@ -180,7 +180,7 @@ class TestFunction(object):
int puts(const char *);
void *stdout, *stderr;
""")
- ffi.C = ffi.rawload(None)
+ ffi.C = ffi.dlopen(None)
pout = ffi.C.stdout
perr = ffi.C.stderr
assert repr(pout) == "<cdata 'void *'>"
@@ -199,7 +199,7 @@ class TestFunction(object):
ffi.cdef("""
char *strchr(const char *s, int c);
""")
- ffi.C = ffi.rawload(None)
+ ffi.C = ffi.dlopen(None)
p = ffi.new("char[]", "hello world!")
q = ffi.C.strchr(p, ord('w'))
assert str(q) == "world!"
@@ -210,7 +210,7 @@ class TestFunction(object):
struct in_addr { unsigned int s_addr; };
char *inet_ntoa(struct in_addr in);
""")
- ffi.C = ffi.rawload(None)
+ ffi.C = ffi.dlopen(None)
ina = ffi.new("struct in_addr", [0x04040404])
a = ffi.C.inet_ntoa(ina[0])
assert str(a) == '4.4.4.4'