Let cpp_basic unit test pass without method pointers support
This was the only part of the test that didn't work, test at least the rest of it.
This commit is contained in:
parent
e8c6bfbc8f
commit
7bb7fe135a
3 changed files with 12 additions and 7 deletions
|
|
@ -63,7 +63,6 @@ FAILING_CPP_TESTS := \
|
|||
class_ignore \
|
||||
class_scope_weird \
|
||||
constant_pointers \
|
||||
cpp_basic \
|
||||
cpp_basic_global_var_built_in \
|
||||
cpp_basic_template_function \
|
||||
cpp_namespace \
|
||||
|
|
|
|||
|
|
@ -83,13 +83,15 @@ int main(int argc, const char *argv[]) {
|
|||
Bar_global_fval_set(f);
|
||||
assert(Foo_num_get(Bar_global_fval_get()) == 7);
|
||||
|
||||
// test getting, setting and calling function pointers
|
||||
SWIG_CPP_FP func1 = get_func1_ptr();
|
||||
// getting, setting and calling function pointers isn't supported yet
|
||||
#if 0
|
||||
SomeTypeForMemFnPtr func1 = _wrap_get_func1_ptr();
|
||||
Foo_func_ptr_set(f, func1);
|
||||
assert(test_func_ptr(f, 2) == 28);
|
||||
SWIG_CPP_FP func2 = get_func2_ptr();
|
||||
assert(_wrap_test_func_ptr(f, 2) == 28);
|
||||
SomeTypeForMemFnPtr func2 = _wrap_get_func2_ptr();
|
||||
Foo_func_ptr_set(f, func2);
|
||||
assert(test_func_ptr(f, 2) == -14);
|
||||
assert(_wrap_test_func_ptr(f, 2) == -14);
|
||||
#endif
|
||||
|
||||
delete_Bar(b);
|
||||
delete_Foo(f);
|
||||
|
|
@ -104,4 +106,4 @@ int main(int argc, const char *argv[]) {
|
|||
w = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,9 @@ class Foo {
|
|||
return -a*num;
|
||||
}
|
||||
|
||||
#ifndef SWIGC
|
||||
int (Foo::*func_ptr)(int);
|
||||
#endif // SWIGC
|
||||
|
||||
const char* __str__() const { return "Foo"; }
|
||||
};
|
||||
|
|
@ -87,6 +89,7 @@ Foo Bar::global_fval = Foo(3);
|
|||
%}
|
||||
|
||||
/* member function tests */
|
||||
#ifndef SWIGC
|
||||
%inline %{
|
||||
int (Foo::*get_func1_ptr())(int) {
|
||||
return &Foo::func1;
|
||||
|
|
@ -101,6 +104,7 @@ int test_func_ptr(Foo *f, int a) {
|
|||
}
|
||||
|
||||
%}
|
||||
#endif // SWIGC
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue