Three new broken test cases created to test various patches in the patch list.

Bugs 909389, 962115, and 899332.
These bugs all have fixes in the patch system.
Patches 903150, 914926, and 962168.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6110 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
John Lenz 2004-08-23 07:06:01 +00:00
commit 09a0978dfc
6 changed files with 102 additions and 0 deletions

View file

@ -48,8 +48,11 @@ LIBPREFIX = lib
# Broken C++ test cases. (Can be run individually using make testcase.cpptest.)
CPP_TEST_BROKEN += \
defvalue_constructor \
derived_nested \
features \
multiple_inheritance \
namespace_union \
return_const_value \
smart_pointer_namespace2 \
template_default_arg \
template_specialization_defarg \

View file

@ -0,0 +1,14 @@
/* This testcase tests nested derived classes.
This was reported in bug #909389 */
%module derived_nested
%inline %{
class A { int x; };
class B {
class C { int y; }; //generates a warning
class D : public A { int z; }; //generates an error
};
%}

View file

@ -0,0 +1,23 @@
/* This was broken in the perl module. See bug 962115
It tests basic multiple inheritance */
%module multiple_inheritance
%inline %{
class Bar {
public:
virtual int bar() { return 1; }
};
class Foo {
public:
virtual int foo() { return 2; }
};
class FooBar : public Foo, public Bar {
public:
virtual int fooBar() { return 3; }
};
%}

View file

@ -0,0 +1,18 @@
use multiple_inheritance;
$fooBar = new multiple_inheritance::FooBar();
if ($fooBar->foo() != 2) {
print "Runtime test1 failed\n";
exit 1;
}
if ($fooBar->bar() != 1) {
print "Runtime test2 failed\n";
exit 1;
}
if ($fooBar->fooBar() != 3) {
print "Runtime test3 failed\n";
exit 1;
}

View file

@ -0,0 +1,12 @@
import return_const_value
import sys
p = return_const_value.FooPtr.getPtr()
if (p.getVal() != 17):
print "Runtime test1 faild. p.getVal()=", p.getVal()
sys.exit(1)
p = return_const_value.FooPtr.getConstPtr()
if (p.getVal() != 17):
print "Runtime test2 faild. p.getVal()=", p.getVal()
sys.exit(1)

View file

@ -0,0 +1,32 @@
/* This test a return by value constant SWIGTYPE.
It was reported in bug 899332 by Jermey Brown (jhbrown94) */
%module return_const_value
%inline %{
class Foo {
public:
int _val;
Foo(int x): _val(x) {}
int getVal() const {
return _val;
}
};
class FooPtr {
Foo *_ptr;
public:
FooPtr(Foo *p): _ptr(p) {}
static FooPtr getPtr() {
return FooPtr(new Foo(17));
}
static const FooPtr getConstPtr() {
return FooPtr(new Foo(17));
}
const Foo *operator->() {
return _ptr;
}
};
%}