From e2e96ec64fc801f76021d8f61b6d346f52c499ca Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Mon, 15 Nov 2004 22:58:10 +0000 Subject: [PATCH] adding more tests git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6740 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Examples/test-suite/abstract_access.i | 2 ++ SWIG/Examples/test-suite/director_protected.i | 6 +++++- SWIG/Examples/test-suite/features.i | 1 + .../test-suite/multiple_inheritance.i | 5 +---- SWIG/Examples/test-suite/private_assign.i | 16 +++++++++++++--- .../test-suite/python/li_std_vector.i | 19 ++++++++++++++++++- .../test-suite/template_default_arg.i | 4 ++-- 7 files changed, 42 insertions(+), 11 deletions(-) diff --git a/SWIG/Examples/test-suite/abstract_access.i b/SWIG/Examples/test-suite/abstract_access.i index 769160156..b35b02687 100644 --- a/SWIG/Examples/test-suite/abstract_access.i +++ b/SWIG/Examples/test-suite/abstract_access.i @@ -1,5 +1,7 @@ %module abstract_access +%warnfilter(517) A; + %inline %{ class A { public: diff --git a/SWIG/Examples/test-suite/director_protected.i b/SWIG/Examples/test-suite/director_protected.i index 4b3495865..a22a8dfa9 100644 --- a/SWIG/Examples/test-suite/director_protected.i +++ b/SWIG/Examples/test-suite/director_protected.i @@ -83,6 +83,10 @@ private: }; - + +class FooBar : private Foo +{ +}; + } diff --git a/SWIG/Examples/test-suite/features.i b/SWIG/Examples/test-suite/features.i index 77dd4594f..80a4d9b78 100644 --- a/SWIG/Examples/test-suite/features.i +++ b/SWIG/Examples/test-suite/features.i @@ -104,6 +104,7 @@ public: %inline %{ namespace Space { struct WildCards { + virtual ~WildCards() {} virtual WildCards* incy(int a) const { return 0; } virtual WildCards* wincy(int a) { return 0; } virtual WildCards* spider(int a) const { return 0; } diff --git a/SWIG/Examples/test-suite/multiple_inheritance.i b/SWIG/Examples/test-suite/multiple_inheritance.i index 74c261cfe..9afca9542 100644 --- a/SWIG/Examples/test-suite/multiple_inheritance.i +++ b/SWIG/Examples/test-suite/multiple_inheritance.i @@ -1,11 +1,8 @@ /* This was broken in the perl module. See bug 962115 It tests basic multiple inheritance */ -%module multiple_inheritance +%module(ruby_minherit="1") multiple_inheritance -#ifdef SWIGRUBY -#pragma SWIG nowarn=802; // Ruby doesn't support multiple inheritance -#endif #ifdef SWIGJAVA #pragma SWIG nowarn=813; // Java doesn't support multiple inheritance diff --git a/SWIG/Examples/test-suite/private_assign.i b/SWIG/Examples/test-suite/private_assign.i index eab024a88..72fc7c205 100644 --- a/SWIG/Examples/test-suite/private_assign.i +++ b/SWIG/Examples/test-suite/private_assign.i @@ -17,6 +17,11 @@ Foo blah() { return Foo(); } + + class Bar : protected Foo + { + }; + %} #pragma SWIG nowarn=350 // operator new @@ -26,6 +31,11 @@ protected: void *operator new(size_t l) { return malloc(sizeof(TROOT)); } + int prot_meth() + { + return 1; + } + public: TROOT() { @@ -36,7 +46,7 @@ } }; - class A : public TROOT + class A : protected TROOT { }; @@ -46,11 +56,11 @@ // This case only works in python %inline %{ - struct Bar : Foo + struct FooBar : Foo { }; - Bar bar; + FooBar bar; %} diff --git a/SWIG/Examples/test-suite/python/li_std_vector.i b/SWIG/Examples/test-suite/python/li_std_vector.i index bdec7fb20..63fd762ba 100644 --- a/SWIG/Examples/test-suite/python/li_std_vector.i +++ b/SWIG/Examples/test-suite/python/li_std_vector.i @@ -18,7 +18,24 @@ namespace std { %template(DoubleVector) std::vector; -%template(SizeVector) std::vector; +specialize_std_vector(size_t,PyInt_Check,PyInt_AsLong,PyInt_FromLong); + + +%template(sizeVector) std::vector; +%{ + template + struct Param + { + T val; + + Param(T v = 0): val(v) { + } + + operator T() const { return val; } + }; +%} +specialize_std_vector(Param,PyInt_Check,PyInt_AsLong,PyInt_FromLong); +%template(PIntVector) std::vector >; %inline %{ typedef float Real; diff --git a/SWIG/Examples/test-suite/template_default_arg.i b/SWIG/Examples/test-suite/template_default_arg.i index 2bb264605..bbce89451 100644 --- a/SWIG/Examples/test-suite/template_default_arg.i +++ b/SWIG/Examples/test-suite/template_default_arg.i @@ -35,10 +35,10 @@ const T& meth(const T& t = T(0)) { return t; } }; - template class Y : private X { + template class Y : private X { public: // test using on templated class with default args in the method - using X::meth; + using X::meth; }; template struct Z