modify test-suite (barring python atm) to not rely on the -I path to find the input .i file - removes the new warning 125 and sets up the test-suite for testing with ccache. This change required the use of -outcurrentdir and moving the .i files from the language subdirectories to the directory above along with some .i file name changes.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10949 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-11-26 21:35:15 +00:00
commit db83e51441
61 changed files with 390 additions and 709 deletions

View file

@ -52,8 +52,10 @@ CPP_TEST_CASES += \
li_implicit \
li_std_vectora \
li_std_map \
li_std_pair_extra \
li_std_set \
li_std_stream \
li_std_string_extra \
li_std_wstream \
li_std_wstring \
nondynamic \

View file

@ -1,68 +0,0 @@
%module(naturalvar="1") implicittest
%implicitconv;
%inline
{
struct B { };
}
%inline
{
struct A
{
int ii;
A(int i) { ii = 1; }
A(double d) { ii = 2; }
A(const B& b) { ii = 3; }
explicit A(char *s) { ii = 4; }
int get() const { return ii; }
};
int get(const A& a) { return a.ii; }
template <class T>
struct A_T
{
int ii;
A_T(int i) { ii = 1; }
A_T(double d) { ii = 2; }
A_T(const B& b) { ii = 3; }
explicit A_T(char *s) { ii = 4; }
int get() const { return ii; }
};
}
%inline
{
struct Foo
{
int ii;
Foo(){ ii = 0;}
Foo(int){ ii = 1;}
Foo(double){ ii = 2;}
explicit Foo(char *s){ii = 3;}
Foo(const Foo& f){ ii = f.ii;}
};
struct Bar
{
int ii;
Foo f;
Bar() {ii = -1;}
Bar(const Foo& ff){ ii = ff.ii;}
};
int get_b(const Bar&b) { return b.ii; }
Foo foo;
}
%template(A_int) A_T<int>;

View file

@ -1,210 +0,0 @@
%module li_std_pair
//
// activate the automatic comparison methods generation (==,!=,...)
//
%{
#include <algorithm> // for std::swap
%}
%include std_pair.i
%include std_string.i
%include std_complex.i
%inline
%{
struct A
{
int val;
A(int v = 0): val(v)
{
}
};
struct B
{
};
%}
%std_comp_methods(std::pair<std::string, int>);
namespace std {
%template(CIntPair) pair<const int, const int>;
%template() pair<double, double>;
%template(ShortPair) pair<short, short>;
%template(IntPair) pair<int, int>;
%extend pair<int, int>
{
%template(pair) pair<short,short>;
}
%template(SIPair) pair<std::string, int>;
%template(CIPair) pair<std::complex<double>, int>;
%template(SIIPair) pair<std::pair<std::string, int>, int>;
%template(AIntPair) pair<A, int>;
%template(CCIntPair) pair<const A, const pair<int, int> >;
%template(ABPair) pair<A, B>;
%template(IntAPair) pair<int, A>;
%template(pairP1) pair<int, A*>;
%template(pairP2) pair<A*, int>;
%template(pairP3) pair<A*, A*>;
%template(pairP4) pair<int, int*>;
%template(pairP5) pair<int*, int>;
%template(pairP6) pair<int*, int*>;
}
%std_comp_methods(std::pair<std::pair<std::string, int>, int>);
%apply std::pair<int,int> *INOUT {std::pair<int,int> *INOUT2};
%inline %{
/* Test the "out" typemap for pair<T, U> */
std::pair<int, int> makeIntPair(int a, int b) {
return std::make_pair(a, b);
}
/**
* There is no "out" typemap for a pointer to a pair, so
* this should return a wrapped instance of a std::pair
* instead of the native "array" type for the target language.
*/
std::pair<int, int> * makeIntPairPtr(int a, int b) {
static std::pair<int, int> p = std::make_pair(a, b);
return &p;
}
/**
* There is no "out" typemap for a non-const reference to a pair, so
* this should return a wrapped instance of a std::pair instead of
* the native "array" type for the target language.
*/
std::pair<int, int>& makeIntPairRef(int a, int b) {
static std::pair<int, int> p = std::make_pair(a, b);
return p;
}
/**
* There is no "out" typemap for a const reference to a pair, so
* this should return a wrapped instance of a std::pair
* instead of the native "array" type for the target language.
*/
const std::pair<int, int> & makeIntPairConstRef(int a, int b) {
static std::pair<int, int> p = std::make_pair(a, b);
return p;
}
/* Test the "in" typemap for pair<T, U> */
int product1(std::pair<int, int> p) {
return p.first*p.second;
}
/* Test the "in" typemap for const pair<T, U>& */
int product2(const std::pair<int, int>& p) {
return p.first*p.second;
}
std::pair<int, int>
p_ident(std::pair<int, int> p, const std::pair<int, int>& q) {
return p;
}
std::pair<int, A*>
p_identa(const std::pair<int, A*>& p) {
return p;
}
void
d_inout(double *INOUT) {
*INOUT += *INOUT;
}
void
d_inout(int *INOUT) {
*INOUT += *INOUT;
}
int
d_inout2(double *INOUT) {
*INOUT += *INOUT;
return 1;
}
void
p_inout(std::pair<int, int> *INOUT) {
std::swap(INOUT->first, INOUT->second);
}
int
p_inout2(std::pair<int, int> *INOUT) {
std::swap(INOUT->first, INOUT->second);
return 1;
}
void
p_inout3(std::pair<int,int> *INOUT, std::pair<int,int> *INOUT2) {
std::swap(*INOUT, *INOUT2);
}
void
p_inoutd(std::pair<double, double> *INOUT) {
std::swap(INOUT->first, INOUT->second);
}
std::string
s_ident(const std::string& s) {
return s;
}
#if 0
std::pair<char, char>
p_ident(std::pair<char, char> p, const std::pair<char, char>& q) {
return p;
}
/* Test the "in" typemap for const pair<T, U>* */
std::pair<A, B>
p_ident(std::pair<A, B> p, const std::pair<A, B>& q) {
return q;
}
/* Test the "in" typemap for const pair<T, U>* */
std::pair<int, A>
p_ident(std::pair<int, A> p, const std::pair<int, A>& q) {
return p;
}
std::pair<int, int>
p_ident(std::pair<int, int> p, const std::pair<A, int>& q) {
return p;
}
std::pair<int, int>
p_ident(std::pair<int, int> p, const std::pair<A, B>& q) {
return p;
}
#endif
%}
namespace std
{
%template(paircA1) pair<const int, A*>;
%template(paircA2) pair<const int, const A*>;
%template(pairiiA) pair<int,pair<int, A*> >;
}

View file

@ -0,0 +1,59 @@
import li_std_pair_extra
p = (1,2)
p1 = li_std_pair_extra.p_inout(p)
p2 = li_std_pair_extra.p_inoutd(p1)
d1 = li_std_pair_extra.d_inout(2)
i,d2 = li_std_pair_extra.d_inout2(2)
i,p = li_std_pair_extra.p_inout2(p)
p3,p4 = li_std_pair_extra.p_inout3(p1,p1)
psi = li_std_pair_extra.SIPair("hello",1)
pci = li_std_pair_extra.CIPair(1,1)
#psi.first = "hi"
psi = li_std_pair_extra.SIPair("hi",1)
if psi != ("hi",1):
raise RuntimeError
psii = li_std_pair_extra.SIIPair(psi,1)
a = li_std_pair_extra.A()
b = li_std_pair_extra.B()
pab = li_std_pair_extra.ABPair(a,b);
pab.first = a
pab.first.val = 2
if pab.first.val != 2:
raise RuntimeError
pci = li_std_pair_extra.CIntPair(1,0)
a = li_std_pair_extra.A(5)
p1 = li_std_pair_extra.pairP1(1,a.this)
p2 = li_std_pair_extra.pairP2(a,1)
p3 = li_std_pair_extra.pairP3(a,a)
if a.val != li_std_pair_extra.p_identa(p1.this)[1].val:
raise RuntimeError
p = li_std_pair_extra.IntPair(1,10)
p.first = 1
p = li_std_pair_extra.paircA1(1,a)
p.first
p.second
p = li_std_pair_extra.paircA2(1,a)
pp = li_std_pair_extra.pairiiA(1,p)

View file

@ -1,59 +0,0 @@
import li_std_pair
p = (1,2)
p1 = li_std_pair.p_inout(p)
p2 = li_std_pair.p_inoutd(p1)
d1 = li_std_pair.d_inout(2)
i,d2 = li_std_pair.d_inout2(2)
i,p = li_std_pair.p_inout2(p)
p3,p4 = li_std_pair.p_inout3(p1,p1)
psi = li_std_pair.SIPair("hello",1)
pci = li_std_pair.CIPair(1,1)
#psi.first = "hi"
psi = li_std_pair.SIPair("hi",1)
if psi != ("hi",1):
raise RuntimeError
psii = li_std_pair.SIIPair(psi,1)
a = li_std_pair.A()
b = li_std_pair.B()
pab = li_std_pair.ABPair(a,b);
pab.first = a
pab.first.val = 2
if pab.first.val != 2:
raise RuntimeError
pci = li_std_pair.CIntPair(1,0)
a = li_std_pair.A(5)
p1 = li_std_pair.pairP1(1,a.this)
p2 = li_std_pair.pairP2(a,1)
p3 = li_std_pair.pairP3(a,a)
if a.val != li_std_pair.p_identa(p1.this)[1].val:
raise RuntimeError
p = li_std_pair.IntPair(1,10)
p.first = 1
p = li_std_pair.paircA1(1,a)
p.first
p.second
p = li_std_pair.paircA2(1,a)
pp = li_std_pair.pairiiA(1,p)

View file

@ -1,55 +0,0 @@
%module li_std_string
%naturalvar A;
%include <std_basic_string.i>
%include <std_string.i>
%inline %{
struct A : std::string
{
A(const std::string& s) : std::string(s)
{
}
};
struct B
{
B(const std::string& s) : cname(0), name(s), a(s)
{
}
char *cname;
std::string name;
A a;
};
const char* test_ccvalue(const char* x) {
return x;
}
char* test_cvalue(char* x) {
return x;
}
std::basic_string<char> test_value_basic1(std::basic_string<char> x) {
return x;
}
std::basic_string<char,std::char_traits<char> > test_value_basic2(std::basic_string<char,std::char_traits<char> > x) {
return x;
}
std::basic_string<char,std::char_traits<char>,std::allocator<char> > test_value_basic3(std::basic_string<char,std::char_traits<char>,std::allocator<char> > x) {
return x;
}
%}
%include ../li_std_string.i

View file

@ -1,24 +1,24 @@
import li_std_string
import li_std_string_extra
x="hello"
if li_std_string.test_ccvalue(x) != x:
if li_std_string_extra.test_ccvalue(x) != x:
raise RuntimeError, "bad string mapping"
if li_std_string.test_cvalue(x) != x:
if li_std_string_extra.test_cvalue(x) != x:
raise RuntimeError, "bad string mapping"
if li_std_string.test_value(x) != x:
print x, li_std_string.test_value(x)
if li_std_string_extra.test_value(x) != x:
print x, li_std_string_extra.test_value(x)
raise RuntimeError, "bad string mapping"
if li_std_string.test_const_reference(x) != x:
if li_std_string_extra.test_const_reference(x) != x:
raise RuntimeError, "bad string mapping"
s = li_std_string.string("he")
s = li_std_string_extra.string("he")
#s += "ll"
#s.append('o')
s = s + "llo"
@ -30,21 +30,21 @@ if s != x:
if s[1:4] != x[1:4]:
raise RuntimeError, "bad string mapping"
if li_std_string.test_value(s) != x:
if li_std_string_extra.test_value(s) != x:
raise RuntimeError, "bad string mapping"
if li_std_string.test_const_reference(s) != x:
if li_std_string_extra.test_const_reference(s) != x:
raise RuntimeError, "bad string mapping"
a = li_std_string.A(s)
a = li_std_string_extra.A(s)
if li_std_string.test_value(a) != x:
if li_std_string_extra.test_value(a) != x:
raise RuntimeError, "bad string mapping"
if li_std_string.test_const_reference(a) != x:
if li_std_string_extra.test_const_reference(a) != x:
raise RuntimeError, "bad string mapping"
b = li_std_string.string(" world")
b = li_std_string_extra.string(" world")
s = a + b
if a + b != "hello world":
@ -63,40 +63,40 @@ if c.find_last_of("l") != 9:
s = "hello world"
b = li_std_string.B("hi")
b = li_std_string_extra.B("hi")
b.name = li_std_string.string("hello")
b.name = li_std_string_extra.string("hello")
if b.name != "hello":
raise RuntimeError, "bad string mapping"
b.a = li_std_string.A("hello")
b.a = li_std_string_extra.A("hello")
if b.a != "hello":
raise RuntimeError, "bad string mapping"
if li_std_string.test_value_basic1(x) != x:
if li_std_string_extra.test_value_basic1(x) != x:
raise RuntimeError, "bad string mapping"
if li_std_string.test_value_basic2(x) != x:
if li_std_string_extra.test_value_basic2(x) != x:
raise RuntimeError, "bad string mapping"
if li_std_string.test_value_basic3(x) != x:
if li_std_string_extra.test_value_basic3(x) != x:
raise RuntimeError, "bad string mapping"
# Global variables
s = "initial string"
if li_std_string.cvar.GlobalString2 != "global string 2":
if li_std_string_extra.cvar.GlobalString2 != "global string 2":
raise RuntimeError, "GlobalString2 test 1"
li_std_string.cvar.GlobalString2 = s
if li_std_string.cvar.GlobalString2 != s:
li_std_string_extra.cvar.GlobalString2 = s
if li_std_string_extra.cvar.GlobalString2 != s:
raise RuntimeError, "GlobalString2 test 2"
if li_std_string.cvar.ConstGlobalString != "const global string":
if li_std_string_extra.cvar.ConstGlobalString != "const global string":
raise RuntimeError, "ConstGlobalString test"
# Member variables
myStructure = li_std_string.Structure()
myStructure = li_std_string_extra.Structure()
if myStructure.MemberString2 != "member string 2":
raise RuntimeError, "MemberString2 test 1"
myStructure.MemberString2 = s
@ -105,28 +105,28 @@ if myStructure.MemberString2 != s:
if myStructure.ConstMemberString != "const member string":
raise RuntimeError, "ConstMemberString test"
if li_std_string.cvar.Structure_StaticMemberString2 != "static member string 2":
if li_std_string_extra.cvar.Structure_StaticMemberString2 != "static member string 2":
raise RuntimeError, "StaticMemberString2 test 1"
li_std_string.cvar.Structure_StaticMemberString2 = s
if li_std_string.cvar.Structure_StaticMemberString2 != s:
li_std_string_extra.cvar.Structure_StaticMemberString2 = s
if li_std_string_extra.cvar.Structure_StaticMemberString2 != s:
raise RuntimeError, "StaticMemberString2 test 2"
if li_std_string.cvar.Structure_ConstStaticMemberString != "const static member string":
if li_std_string_extra.cvar.Structure_ConstStaticMemberString != "const static member string":
raise RuntimeError, "ConstStaticMemberString test"
if li_std_string.test_reference_input("hello") != "hello":
if li_std_string_extra.test_reference_input("hello") != "hello":
raise RuntimeError
s = li_std_string.test_reference_inout("hello")
s = li_std_string_extra.test_reference_inout("hello")
if s != "hellohello":
raise RuntimeError
if li_std_string.stdstring_empty() != "":
if li_std_string_extra.stdstring_empty() != "":
raise RuntimeError
if li_std_string.c_empty() != "":
if li_std_string_extra.c_empty() != "":
raise RuntimeError
if li_std_string.c_null() != None:
if li_std_string_extra.c_null() != None:
raise RuntimeError