Add test of null shared pointers emitted from C++
This tests nulls emitted as pointers and values of shared pointers, created from null, from references, and from default constructors.
This commit is contained in:
parent
01995ec14f
commit
b08713f09f
2 changed files with 17 additions and 0 deletions
|
|
@ -242,6 +242,10 @@ std::string nullsmartpointerpointertest(SwigBoost::shared_ptr<Klass>* k) {
|
|||
else
|
||||
return "also not null";
|
||||
}
|
||||
|
||||
SwigBoost::shared_ptr<Klass>* sp_pointer_null() { return NULL; }
|
||||
SwigBoost::shared_ptr<Klass>* null_sp_pointer() { static SwigBoost::shared_ptr<Klass> static_sp; return &static_sp; }
|
||||
SwigBoost::shared_ptr<Klass> sp_value_null() { return SwigBoost::shared_ptr<Klass>(); }
|
||||
// $owner
|
||||
Klass *pointerownertest() {
|
||||
return new Klass("pointerownertest");
|
||||
|
|
|
|||
|
|
@ -168,6 +168,19 @@ class li_boost_shared_ptr_runme:
|
|||
except ValueError:
|
||||
pass
|
||||
|
||||
# test null pointers emitted from C++
|
||||
k = li_boost_shared_ptr.sp_pointer_null()
|
||||
if (li_boost_shared_ptr.smartpointertest(k) != None):
|
||||
raise RuntimeError("return was not null")
|
||||
|
||||
k = li_boost_shared_ptr.null_sp_pointer()
|
||||
if (li_boost_shared_ptr.smartpointertest(k) != None):
|
||||
raise RuntimeError("return was not null")
|
||||
|
||||
k = li_boost_shared_ptr.sp_value_null()
|
||||
if (li_boost_shared_ptr.smartpointertest(k) != None):
|
||||
raise RuntimeError("return was not null")
|
||||
|
||||
# $owner
|
||||
k = li_boost_shared_ptr.pointerownertest()
|
||||
val = k.getValue()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue