Fix typecheck typemaps for SWIGTYPE *const&

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12413 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2011-01-30 00:42:27 +00:00
commit 640cce2c50
9 changed files with 47 additions and 4 deletions

View file

@ -12,6 +12,9 @@ public class pointer_reference_runme {
Struct ss = new Struct(20);
pointer_reference.set(ss);
if (Struct.instance.value != 20) throw new Exception("set test failed");
if (pointer_reference.overloading(1) != 111) throw new Exception("overload test 1 failed");
if (pointer_reference.overloading(ss) != 222) throw new Exception("overload test 2 failed");
}
}

View file

@ -19,5 +19,8 @@ public class pointer_reference_runme {
Struct ss = new Struct(20);
pointer_reference.set(ss);
if (Struct.getInstance().getValue() != 20) throw new RuntimeException("set test failed");
if (pointer_reference.overloading(1) != 111) throw new RuntimeException("overload test 1 failed");
if (pointer_reference.overloading(ss) != 222) throw new RuntimeException("overload test 2 failed");
}
}

View file

@ -9,3 +9,5 @@ ss = pointer_reference.Struct(20);
pointer_reference.set(ss);
assert(pointer_reference.Struct_instance.value == 20)
assert(pointer_reference.overloading(1) == 111)
assert(pointer_reference.overloading(ss) == 222)

View file

@ -11,5 +11,8 @@ pointer_reference::set($ss);
$i = Struct::instance();
check::equal($i->value, 20, "pointer_reference::set() failed");
check::equal(pointer_reference::overloading(1), 111, "overload test 1 failed");
check::equal(pointer_reference::overloading($ss), 222, "overload test 2 failed");
check::done();
?>

View file

@ -35,6 +35,12 @@ void set(Struct *const& s) {
Struct *const& get() {
return Struct::pInstance;
}
int overloading(int i) {
return 111;
}
int overloading(Struct *const& s) {
return 222;
}
%}
%{

View file

@ -0,0 +1,16 @@
import pointer_reference
s = pointer_reference.get()
if s.value != 10:
raise RuntimeError, "get test failed"
ss = pointer_reference.Struct(20)
pointer_reference.set(ss)
if pointer_reference.cvar.Struct_instance.value != 20:
raise RuntimeError, "set test failed"
if pointer_reference.overloading(1) != 111:
raise RuntimeError, "overload test 1 failed"
if pointer_reference.overloading(ss) != 222:
raise RuntimeError, "overload test 2 failed"