Add raw pointer handling test for virtual inheritance
This is a test added for D in previous commit, now expanded to all target languages. Tidy up counting object instances.
This commit is contained in:
parent
910fd1e3cf
commit
d4b1152d4b
20 changed files with 236 additions and 224 deletions
|
|
@ -15,6 +15,13 @@ proc checkCount {expected_count} {
|
|||
# Not copied from cpp11_std_unique_ptr_runme.tcl
|
||||
################################# Tcl pointer recycling bug end
|
||||
|
||||
# Test raw pointer handling involving virtual inheritance
|
||||
KlassInheritance kini "KlassInheritanceInput"
|
||||
checkCount 1
|
||||
set s [takeKlassAutoPtr kini]
|
||||
kini -delete
|
||||
checkCount 0
|
||||
|
||||
|
||||
# auto_ptr as input
|
||||
Klass kin "KlassInput"
|
||||
|
|
@ -93,20 +100,14 @@ checkCount 0
|
|||
# auto_ptr as output
|
||||
set k1 [makeKlassAutoPtr "first"]
|
||||
set k2 [makeKlassAutoPtr "second"]
|
||||
if {[Klass_getTotal_count] != 2} {
|
||||
error "number of objects should be 2"
|
||||
}
|
||||
checkCount 2
|
||||
|
||||
$k1 -delete
|
||||
if {[Klass_getTotal_count] != 1} {
|
||||
error "number of objects should be 1"
|
||||
}
|
||||
checkCount 1
|
||||
|
||||
if {[$k2 getLabel] != "second"} {
|
||||
error "wrong object label"
|
||||
}
|
||||
|
||||
$k2 -delete
|
||||
if {[Klass_getTotal_count] != 0} {
|
||||
error "no objects should be left"
|
||||
}
|
||||
checkCount 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue