From 6cc9a65e5607677b05aad3f7378a5fe077b55385 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 21 Feb 2010 14:27:30 +0100 Subject: [PATCH] fix wrapper tests, now that the compiler is fixed --- tests/bugs.txt | 1 - tests/wrappers/cpp_overload_wrapper.pyx | 32 ++++++++++++++++++++- tests/wrappers/cpp_overload_wrapper_lib.cpp | 2 +- tests/wrappers/cpp_overload_wrapper_lib.pxd | 2 +- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/tests/bugs.txt b/tests/bugs.txt index 33339703..6c7e7aa6 100644 --- a/tests/bugs.txt +++ b/tests/bugs.txt @@ -9,4 +9,3 @@ missing_baseclass_in_predecl_T262 cfunc_call_tuple_args_T408 cascaded_list_unpacking_T467 compile.cpp_operators -cpp_overload_wrapper diff --git a/tests/wrappers/cpp_overload_wrapper.pyx b/tests/wrappers/cpp_overload_wrapper.pyx index c1839c9f..8b9b8411 100644 --- a/tests/wrappers/cpp_overload_wrapper.pyx +++ b/tests/wrappers/cpp_overload_wrapper.pyx @@ -1,7 +1,18 @@ -cimport cppwrap_lib +cimport cpp_overload_wrapper_lib as cppwrap_lib cdef class DoubleKeeper: + """ + >>> d = DoubleKeeper() + >>> d.get_number() + 1.0 + >>> d.set_number(5.5) + >>> d.get_number() + 5.5 + >>> d.set_number(0) + >>> d.get_number() + 0.0 + """ cdef cppwrap_lib.DoubleKeeper* keeper def __cinit__(self, number=None): @@ -23,14 +34,33 @@ cdef class DoubleKeeper: return self.keeper.get_number() def transmogrify(self, double value): + """ + >>> d = DoubleKeeper(5.5) + >>> d.transmogrify(1.0) + 5.5 + >>> d.transmogrify(2.0) + 11.0 + """ return self.keeper.transmogrify(value) def voidfunc(): + """ + >>> voidfunc() + """ cppwrap_lib.voidfunc() def doublefunc(double x, double y, double z): + """ + >>> doublefunc(1.0, 2.0, 3.0) == 1.0 + 2.0 + 3.0 + True + """ return cppwrap_lib.doublefunc(x, y, z) def transmogrify_from_cpp(DoubleKeeper obj not None, double value): + """ + >>> d = DoubleKeeper(2.0) + >>> d.transmogrify(3.0) == 6.0 + True + """ return cppwrap_lib.transmogrify_from_cpp(obj.keeper, value) diff --git a/tests/wrappers/cpp_overload_wrapper_lib.cpp b/tests/wrappers/cpp_overload_wrapper_lib.cpp index 3668120b..a031f975 100644 --- a/tests/wrappers/cpp_overload_wrapper_lib.cpp +++ b/tests/wrappers/cpp_overload_wrapper_lib.cpp @@ -1,5 +1,5 @@ -#include "cppwrap_lib.h" +#include "cpp_overload_wrapper_lib.h" void voidfunc (void) { diff --git a/tests/wrappers/cpp_overload_wrapper_lib.pxd b/tests/wrappers/cpp_overload_wrapper_lib.pxd index d92ca89d..17397005 100644 --- a/tests/wrappers/cpp_overload_wrapper_lib.pxd +++ b/tests/wrappers/cpp_overload_wrapper_lib.pxd @@ -1,5 +1,5 @@ -cdef extern from "testapi.h": +cdef extern from "cpp_overload_wrapper_lib.h": void voidfunc() double doublefunc(double a, double b, double c) -- 2.26.2