Run overload_complicated testcase

Was marked as broken, seems to work now
This commit is contained in:
William S Fulton 2017-10-04 20:43:44 +01:00
commit f4644d7c30
6 changed files with 35 additions and 33 deletions

View file

@ -89,7 +89,6 @@ CPP_TEST_BROKEN += \
extend_variable \ extend_variable \
li_boost_shared_ptr_template \ li_boost_shared_ptr_template \
nested_private \ nested_private \
overload_complicated \
rename_camel \ rename_camel \
template_default_pointer \ template_default_pointer \
template_private_assignment \ template_private_assignment \
@ -325,6 +324,7 @@ CPP_TEST_CASES += \
ordering \ ordering \
overload_arrays \ overload_arrays \
overload_bool \ overload_bool \
overload_complicated \
overload_copy \ overload_copy \
overload_extend \ overload_extend \
overload_method \ overload_method \

View file

@ -14,8 +14,8 @@
(check (=~ (foo 1 2 "bar" 4) 15)) (check (=~ (foo 1 2 "bar" 4) 15))
;; Check second method ;; Check second method
(check (=~ (foo 1 2) 4811.4)) (check (=~ (foo 1 2) 118))
(check (=~ (foo 1 2 3.2) 4797.2)) (check (=~ (foo 1 2 3.2) 104))
(check (=~ (foo 1 2 3.2 #\Q) 4798.2)) (check (=~ (foo 1 2 3.2 #\Q) 4798))
(exit 0) (exit 0)

View file

@ -12,11 +12,11 @@ assert(oc.foo(1,1,"test",1) == 15)
p1 = oc.Pop(nil) p1 = oc.Pop(nil)
p1 = oc.Pop(nil,false) p1 = oc.Pop(nil,false)
assert(p1:hip(true) == 701) assert(p1:hip(false) == 701)
assert(p1:hip(nil) == 702) assert(p1:hip(nil) == 702)
assert(p1:hop(true) == 801) assert(p1:hop(false) == 801)
assert(p1:hop(nil) == 805) assert(p1:hop(nil) == 805)
assert(oc.muzak(true) == 3001) assert(oc.muzak(false) == 3001)
assert(oc.muzak(nil) == 3002) assert(oc.muzak(nil) == 3002)

View file

@ -5,15 +5,15 @@ endif
overload_complicated overload_complicated
pInt = None; pInt = []; # NULL
# Check the correct constructors are available # Check the correct constructors are available
p = Pop(pInt); p = Pop(pInt);
p = Pop(pInt, 0); p = Pop(pInt, false);
# Check overloaded in const only and pointers/references which target languages cannot disambiguate # Check overloaded in const only and pointers/references which target languages cannot disambiguate
if (p.hip(0) != 701) if (p.hip(false) != 701)
error("Test 1 failed") error("Test 1 failed")
endif endif
@ -26,16 +26,16 @@ if (p.hop(pInt) != 805)
error("Test 3 failed") error("Test 3 failed")
endif endif
if (p.hop(0) != 801) if (p.hop(false) != 801)
error("Test 4 failed") error("Test 4 failed")
endif endif
# Few more variations and order shuffled # Few more variations and order shuffled
if (p.pop(0) != 901) if (p.pop(false) != 901)
error("Test 5 failed") error("Test 5 failed")
endif endif
if (p.pop(pInt) != 902) if (p.pop(pInt) != 904)
error("Test 6 failed") error("Test 6 failed")
endif endif
@ -48,12 +48,12 @@ if (p.bop(pInt) != 1001)
error("Test 8 failed") error("Test 8 failed")
endif endif
if (p.bip(pInt) != 2001) if (p.bip(pInt) != 2002)
error("Test 9 failed") error("Test 9 failed")
endif endif
# Globals # Globals
if (muzak(0) != 3001) if (muzak(false) != 3001)
error("Test 10 failed") error("Test 10 failed")
endif endif

View file

@ -3,25 +3,27 @@
#ifndef SWIG_NO_OVERLOAD #ifndef SWIG_NO_OVERLOAD
// Different warning filters needed for scripting languages (eg Python) and for statically typed languages (eg C#). // Different overloaded warning filters needed for scripting languages (eg Python) and for statically typed languages (eg C#).
%warnfilter(509, 516) Pop::Pop; // Overloaded xxxx is shadowed by xxxx at xxx:y. | Overloaded method xxxx ignored. Method at xxx:y used. %warnfilter(509, 516) Pop::Pop;
%warnfilter(509, 516) Pop::hip; // Overloaded xxxx is shadowed by xxxx at xxx:y. | Overloaded method xxxx ignored. Method at xxx:y used. %warnfilter(509, 516) Pop::hip;
%warnfilter(509, 516) Pop::hop; // Overloaded xxxx is shadowed by xxxx at xxx:y. | Overloaded method xxxx ignored. Method at xxx:y used. %warnfilter(509, 516) Pop::hop;
%warnfilter(509, 516) Pop::pop; // Overloaded xxxx is shadowed by xxxx at xxx:y. | Overloaded method xxxx ignored. Method at xxx:y used. %warnfilter(509, 516) Pop::pop;
%warnfilter(516) Pop::bop; // Overloaded method xxxx ignored. Method at xxx:y used. %warnfilter(516) Pop::bop;
%warnfilter(516) Pop::bip; // Overloaded method xxxx ignored. Method at xxx:y used. %warnfilter(516) Pop::bip;
%warnfilter(509, 516) ::muzak; // Overloaded xxxx is shadowed by xxxx at xxx:y. | Overloaded method xxxx ignored. Method at xxx:y used. %warnfilter(509, 516) ::muzak;
%warnfilter(509, 516) foo;
%typemap(in, numinputs=0) int l { $1 = 4711; } %typemap(in, numinputs=0) int l { $1 = 4711; }
%inline %{ %inline %{
double foo(int, int, char *, int) { int foo(int, int, char *, int) {
return 15; return 15;
} }
double foo(int i, int j, double k = 17.4, int l = 18, char m = 'P') { int foo(int i, int j, double k = 17.4, int l = 18 /* Note numinputs typemap above */, char m = 'P') {
return i + j + k + l + (int) m; int sum = i + j + (int)k + l + (int)m;
return sum;
} }
struct Pop { struct Pop {

View file

@ -5,11 +5,11 @@ pInt = None
# Check the correct constructors are available # Check the correct constructors are available
p = Pop(pInt) p = Pop(pInt)
p = Pop(pInt, 0) p = Pop(pInt, False)
# Check overloaded in const only and pointers/references which target # Check overloaded in const only and pointers/references which target
# languages cannot disambiguate # languages cannot disambiguate
if p.hip(0) != 701: if p.hip(False) != 701:
raise RuntimeError, "Test 1 failed" raise RuntimeError, "Test 1 failed"
if p.hip(pInt) != 702: if p.hip(pInt) != 702:
@ -19,14 +19,14 @@ if p.hip(pInt) != 702:
if p.hop(pInt) != 805: if p.hop(pInt) != 805:
raise RuntimeError, "Test 3 failed" raise RuntimeError, "Test 3 failed"
if p.hop(0) != 801: if p.hop(False) != 801:
raise RuntimeError, "Test 4 failed" raise RuntimeError, "Test 4 failed"
# Few more variations and order shuffled # Few more variations and order shuffled
if p.pop(0) != 901: if p.pop(False) != 901:
raise RuntimeError, "Test 5 failed" raise RuntimeError, "Test 5 failed"
if p.pop(pInt) != 902: if p.pop(pInt) != 904:
raise RuntimeError, "Test 6 failed" raise RuntimeError, "Test 6 failed"
if p.pop() != 905: if p.pop() != 905:
@ -36,11 +36,11 @@ if p.pop() != 905:
if p.bop(pInt) != 1001: if p.bop(pInt) != 1001:
raise RuntimeError, "Test 8 failed" raise RuntimeError, "Test 8 failed"
if p.bip(pInt) != 2001: if p.bip(pInt) != 2002:
raise RuntimeError, "Test 9 failed" raise RuntimeError, "Test 9 failed"
# Globals # Globals
if muzak(0) != 3001: if muzak(False) != 3001:
raise RuntimeError, "Test 10 failed" raise RuntimeError, "Test 10 failed"
if muzak(pInt) != 3002: if muzak(pInt) != 3002: