swig/Examples/test-suite/python/friends_runme.py
Marcelo Matus 708021a809 These is the current tests for the friend function support.
They will give you and idea of what is currently working.

If you have another case you think we need to test, please
send me an email to add it and trying it here.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5581 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-20 07:46:27 +00:00

28 lines
677 B
Python

import friends
a = friends.A(2)
if friends.get_val1(a) != 2: raise RuntimeError
if friends.get_val2(a) != 4: raise RuntimeError
if friends.get_val3(a) != 6: raise RuntimeError
# nice overload working fine
if friends.get_val1(1,2,3) != 1: raise RuntimeError
b = friends.B(3)
# David's case
if friends.mix(a,b) != 5: raise RuntimeError
di = friends.D_d(2)
dd = friends.D_d(3.3)
# incredible template overloading working just fine
if friends.get_val1(di) != 2: raise RuntimeError
if friends.get_val1(dd) != 3.3: raise RuntimeError
friends.set(di, 4)
friends.set(dd, 1.3)
if friends.get_val1(di) != 4: raise RuntimeError
if friends.get_val1(dd) != 1.3: raise RuntimeError