add iostream test
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6771 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c4d6cdf0ab
commit
36bfc66486
4 changed files with 45 additions and 1 deletions
32
Examples/test-suite/python/lib_std_stream.i
Normal file
32
Examples/test-suite/python/lib_std_stream.i
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
%module lib_std_stream
|
||||
|
||||
%include <std_iostream.i>
|
||||
|
||||
|
||||
%pythoncallback(1) A::bar;
|
||||
|
||||
%inline %{
|
||||
|
||||
struct A
|
||||
{
|
||||
void __add__(int a)
|
||||
{
|
||||
}
|
||||
|
||||
void __add__(double a)
|
||||
{
|
||||
}
|
||||
|
||||
static int bar(int a){
|
||||
return a;
|
||||
}
|
||||
|
||||
static int foo(int a, int (*pf)(int a))
|
||||
{
|
||||
return pf(a);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
%}
|
||||
10
Examples/test-suite/python/lib_std_stream_runme.py
Normal file
10
Examples/test-suite/python/lib_std_stream_runme.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import lib_std_stream as std
|
||||
|
||||
std.cout << 2345 << " " << 1.435 << std.endl
|
||||
std.endl(std.cout)
|
||||
print "hello"
|
||||
|
||||
a = std.A()
|
||||
|
||||
print a.bar(2)
|
||||
print a.foo(4, a.bar)
|
||||
Loading…
Add table
Add a link
Reference in a new issue