interface feature test changes for the tests to pass for all languages
This commit is contained in:
parent
5cf20086a4
commit
5d58de60d6
7 changed files with 49 additions and 24 deletions
|
|
@ -59,12 +59,12 @@ public class multiple_inheritance_abstract_runme {
|
||||||
check(cb2.cbase2()!=2, "CBase2::cbase2() failed");
|
check(cb2.cbase2()!=2, "CBase2::cbase2() failed");
|
||||||
|
|
||||||
//Test abstract class as return value
|
//Test abstract class as return value
|
||||||
ABase1 ab1=d3.clone();
|
ABase1 ab1=d3.cloneit();
|
||||||
check(ab1.abase1()!=9, "Derived3::abase1() through ABase1 failed");
|
check(ab1.abase1()!=9, "Derived3::abase1() through ABase1 failed");
|
||||||
|
|
||||||
//Test concrete base class as return value
|
//Test concrete base class as return value
|
||||||
CBase1 cb6=d2.clone();
|
CBase1 cb6=d2.cloneit();
|
||||||
CBase2 cb7=d1.clone();
|
CBase2 cb7=d1.cloneit();
|
||||||
check(cb6.cbase1y()!=6, "Derived2::cbase1y() through CBase1 failed");
|
check(cb6.cbase1y()!=6, "Derived2::cbase1y() through CBase1 failed");
|
||||||
check(cb7.cbase2()!=4, "Derived1:cbase2() through ABase1 failed");
|
check(cb7.cbase2()!=4, "Derived1:cbase2() through ABase1 failed");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,12 +60,12 @@ public class multiple_inheritance_nspace_runme {
|
||||||
check(cb2.cbase2()!=2, "CBase2::cbase2() failed");
|
check(cb2.cbase2()!=2, "CBase2::cbase2() failed");
|
||||||
|
|
||||||
//Test nspace class as return value
|
//Test nspace class as return value
|
||||||
IABase1 ab1=d3.clone();
|
IABase1 ab1=d3.cloneit();
|
||||||
check(ab1.abase1()!=9, "Derived3::abase1() through ABase1 failed");
|
check(ab1.abase1()!=9, "Derived3::abase1() through ABase1 failed");
|
||||||
|
|
||||||
//Test concrete base class as return value
|
//Test concrete base class as return value
|
||||||
ICBase1 cb6=d2.clone();
|
ICBase1 cb6=d2.cloneit();
|
||||||
ICBase2 cb7=d1.clone();
|
ICBase2 cb7=d1.cloneit();
|
||||||
check(cb6.cbase1y()!=6, "Derived2::cbase1y() through CBase1 failed");
|
check(cb6.cbase1y()!=6, "Derived2::cbase1y() through CBase1 failed");
|
||||||
check(cb7.cbase2()!=4, "Derived1:cbase2() through ABase1 failed");
|
check(cb7.cbase2()!=4, "Derived1:cbase2() through ABase1 failed");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,12 +67,12 @@ public class multiple_inheritance_abstract_runme {
|
||||||
check(cb2.cbase2()!=2, "CBase2::cbase2() failed");
|
check(cb2.cbase2()!=2, "CBase2::cbase2() failed");
|
||||||
|
|
||||||
//Test abstract class as return value
|
//Test abstract class as return value
|
||||||
ABase1 ab1=d3.clone();
|
ABase1 ab1=d3.cloneit();
|
||||||
check(ab1.abase1()!=9, "Derived3::abase1() through ABase1 failed");
|
check(ab1.abase1()!=9, "Derived3::abase1() through ABase1 failed");
|
||||||
|
|
||||||
//Test concrete base class as return value
|
//Test concrete base class as return value
|
||||||
CBase1 cb6=d2.clone();
|
CBase1 cb6=d2.cloneit();
|
||||||
CBase2 cb7=d1.clone();
|
CBase2 cb7=d1.cloneit();
|
||||||
check(cb6.cbase1y()!=6, "Derived2::cbase1y() through CBase1 failed");
|
check(cb6.cbase1y()!=6, "Derived2::cbase1y() through CBase1 failed");
|
||||||
check(cb7.cbase2()!=4, "Derived1:cbase2() through ABase1 failed");
|
check(cb7.cbase2()!=4, "Derived1:cbase2() through ABase1 failed");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,12 +69,12 @@ public class multiple_inheritance_nspace_runme {
|
||||||
check(cb2.cbase2()!=2, "CBase2::cbase2() failed");
|
check(cb2.cbase2()!=2, "CBase2::cbase2() failed");
|
||||||
|
|
||||||
//Test nspace class as return value
|
//Test nspace class as return value
|
||||||
IABase1 ab1=d3.clone();
|
IABase1 ab1=d3.cloneit();
|
||||||
check(ab1.abase1()!=9, "Derived3::abase1() through ABase1 failed");
|
check(ab1.abase1()!=9, "Derived3::abase1() through ABase1 failed");
|
||||||
|
|
||||||
//Test concrete base class as return value
|
//Test concrete base class as return value
|
||||||
ICBase1 cb6=d2.clone();
|
ICBase1 cb6=d2.cloneit();
|
||||||
ICBase2 cb7=d1.clone();
|
ICBase2 cb7=d1.cloneit();
|
||||||
check(cb6.cbase1y()!=6, "Derived2::cbase1y() through CBase1 failed");
|
check(cb6.cbase1y()!=6, "Derived2::cbase1y() through CBase1 failed");
|
||||||
check(cb7.cbase2()!=4, "Derived1:cbase2() through ABase1 failed");
|
check(cb7.cbase2()!=4, "Derived1:cbase2() through ABase1 failed");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
// This is a copy of the multiple_inheritance_abstract test
|
// This is a copy of the multiple_inheritance_abstract test
|
||||||
%module multiple_inheritance_abstract
|
%module multiple_inheritance_abstract
|
||||||
|
|
||||||
|
%warnfilter(SWIGWARN_RUBY_MULTIPLE_INHERITANCE,
|
||||||
|
SWIGWARN_D_MULTIPLE_INHERITANCE,
|
||||||
|
SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance or %interface */
|
||||||
|
|
||||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
||||||
%include "swiginterface.i"
|
%include "swiginterface.i"
|
||||||
%interface_impl(Space::ABase1)
|
%interface_impl(Space::ABase1)
|
||||||
|
|
@ -8,6 +12,12 @@
|
||||||
%interface_impl(Space::CBase2)
|
%interface_impl(Space::CBase2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(SWIGD)
|
||||||
|
// Missing multiple inheritance support results in incorrect use of override
|
||||||
|
%ignore CBase1;
|
||||||
|
%ignore CBase2;
|
||||||
|
#endif
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
namespace Space {
|
namespace Space {
|
||||||
struct CBase1 {
|
struct CBase1 {
|
||||||
|
|
@ -48,7 +58,7 @@ namespace Space {
|
||||||
virtual int cbase2() {
|
virtual int cbase2() {
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
virtual CBase2 *clone() {
|
virtual CBase2 *cloneit() {
|
||||||
return new Derived1(*this);
|
return new Derived1(*this);
|
||||||
}
|
}
|
||||||
void derived1() {
|
void derived1() {
|
||||||
|
|
@ -65,7 +75,7 @@ namespace Space {
|
||||||
virtual int abase1() {
|
virtual int abase1() {
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
virtual CBase1 *clone() {
|
virtual CBase1 *cloneit() {
|
||||||
return new Derived2(*this);
|
return new Derived2(*this);
|
||||||
}
|
}
|
||||||
void derived2() {
|
void derived2() {
|
||||||
|
|
@ -84,7 +94,7 @@ namespace Space {
|
||||||
}
|
}
|
||||||
virtual void cbase1x() {
|
virtual void cbase1x() {
|
||||||
}
|
}
|
||||||
virtual ABase1 *clone() {
|
virtual ABase1 *cloneit() {
|
||||||
return new Derived3(*this);
|
return new Derived3(*this);
|
||||||
}
|
}
|
||||||
void derived3() {
|
void derived3() {
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,24 @@
|
||||||
%module multiple_inheritance_interfaces
|
%module multiple_inheritance_interfaces
|
||||||
|
|
||||||
|
%warnfilter(SWIGWARN_RUBY_MULTIPLE_INHERITANCE,
|
||||||
|
SWIGWARN_D_MULTIPLE_INHERITANCE,
|
||||||
|
SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance or %interface */
|
||||||
|
|
||||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
||||||
%include "swiginterface.i"
|
%include "swiginterface.i"
|
||||||
%interface_custom("A", "IA", IA)
|
%interface_custom("A", "IA", IA)
|
||||||
%interface_custom("B", "IB", IB)
|
%interface_custom("B", "IB", IB)
|
||||||
%interface_custom("%(strip:[I])s", "I%s", IC) // same as %interface_custom("C", "IC", IC)
|
%interface_custom("%(strip:[I])s", "I%s", IC) // same as %interface_custom("C", "IC", IC)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
struct IA {
|
struct IA {
|
||||||
virtual void ia() {};
|
virtual void ia() {};
|
||||||
virtual void ia(const char *s, bool b = true) {}
|
virtual void ia(const char *s, bool b = true) {}
|
||||||
virtual void ia(int i) {}
|
virtual void ia(int i) {}
|
||||||
|
virtual ~IA() {}
|
||||||
};
|
};
|
||||||
struct IB { virtual void ib() {} };
|
struct IB { virtual ~IB() {} virtual void ib() {} };
|
||||||
struct IC : IA, IB {};
|
struct IC : IA, IB {};
|
||||||
struct D : IC {};
|
struct D : IC {};
|
||||||
struct E : D {};
|
struct E : D {};
|
||||||
|
|
@ -24,7 +30,7 @@ struct E : D {};
|
||||||
%interface_custom("L", "IL", IL)
|
%interface_custom("L", "IL", IL)
|
||||||
#endif
|
#endif
|
||||||
%inline %{
|
%inline %{
|
||||||
struct IJ { virtual void ij() {} };
|
struct IJ { virtual ~IJ() {}; virtual void ij() {} };
|
||||||
struct IK : IJ {};
|
struct IK : IJ {};
|
||||||
struct IL : IK {};
|
struct IL : IK {};
|
||||||
struct M : IL {};
|
struct M : IL {};
|
||||||
|
|
@ -34,8 +40,8 @@ struct M : IL {};
|
||||||
%interface_custom("Q", "IQ", IQ)
|
%interface_custom("Q", "IQ", IQ)
|
||||||
#endif
|
#endif
|
||||||
%inline %{
|
%inline %{
|
||||||
struct P { virtual void p() {}; };
|
struct P { virtual ~P() {} virtual void p() {} };
|
||||||
struct IQ { virtual void iq() {}; };
|
struct IQ { virtual ~IQ() {} virtual void iq() {} };
|
||||||
struct R : IQ, P {};
|
struct R : IQ, P {};
|
||||||
struct S : P, IQ {};
|
struct S : P, IQ {};
|
||||||
struct T : IQ {};
|
struct T : IQ {};
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
// This is a copy of the multiple_inheritance_abstract test
|
// This is a copy of the multiple_inheritance_abstract test
|
||||||
%module multiple_inheritance_nspace
|
%module multiple_inheritance_nspace
|
||||||
|
|
||||||
|
%warnfilter(SWIGWARN_RUBY_MULTIPLE_INHERITANCE,
|
||||||
|
SWIGWARN_D_MULTIPLE_INHERITANCE,
|
||||||
|
SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance or %interface */
|
||||||
|
|
||||||
// nspace feature only supported by these languages
|
// nspace feature only supported by these languages
|
||||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
|
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
|
||||||
|
|
||||||
%nspace;
|
%nspace;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
||||||
%include "swiginterface.i"
|
%include "swiginterface.i"
|
||||||
|
|
@ -13,6 +17,12 @@
|
||||||
%interface(Space::CBase2)
|
%interface(Space::CBase2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(SWIGD)
|
||||||
|
// Missing multiple inheritance support results in incorrect use of override
|
||||||
|
%ignore CBase1;
|
||||||
|
%ignore CBase2;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(SWIGJAVA)
|
#if defined(SWIGJAVA)
|
||||||
SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
|
SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -57,7 +67,7 @@ namespace Space {
|
||||||
virtual int cbase2() {
|
virtual int cbase2() {
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
virtual CBase2 *clone() {
|
virtual CBase2 *cloneit() {
|
||||||
return new Derived1(*this);
|
return new Derived1(*this);
|
||||||
}
|
}
|
||||||
void derived1() {
|
void derived1() {
|
||||||
|
|
@ -74,7 +84,7 @@ namespace Space {
|
||||||
virtual int abase1() {
|
virtual int abase1() {
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
virtual CBase1 *clone() {
|
virtual CBase1 *cloneit() {
|
||||||
return new Derived2(*this);
|
return new Derived2(*this);
|
||||||
}
|
}
|
||||||
void derived2() {
|
void derived2() {
|
||||||
|
|
@ -93,7 +103,7 @@ namespace Space {
|
||||||
}
|
}
|
||||||
virtual void cbase1x() {
|
virtual void cbase1x() {
|
||||||
}
|
}
|
||||||
virtual ABase1 *clone() {
|
virtual ABase1 *cloneit() {
|
||||||
return new Derived3(*this);
|
return new Derived3(*this);
|
||||||
}
|
}
|
||||||
void derived3() {
|
void derived3() {
|
||||||
|
|
@ -326,4 +336,3 @@ namespace Space {
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue