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
|
|
@ -12,6 +12,17 @@ function checkCount(expected_count)
|
|||
endif
|
||||
end
|
||||
|
||||
# Test raw pointer handling involving virtual inheritance
|
||||
kini = KlassInheritance("KlassInheritanceInput");
|
||||
checkCount(1);
|
||||
s = takeKlassAutoPtr(kini);
|
||||
if (!strcmp(s, "KlassInheritanceInput"))
|
||||
error("Incorrect string: %s", s);
|
||||
endif
|
||||
clear kini;
|
||||
checkCount(0);
|
||||
|
||||
|
||||
# auto_ptr as input
|
||||
kin = Klass("KlassInput");
|
||||
checkCount(1);
|
||||
|
|
@ -90,20 +101,14 @@ if (!strcmp(k1.getLabel(), "first"))
|
|||
endif
|
||||
|
||||
k2 = makeKlassAutoPtr("second");
|
||||
if (Klass_getTotal_count() != 2)
|
||||
error("number of objects should be 2");
|
||||
endif
|
||||
checkCount(2);
|
||||
|
||||
clear k1;
|
||||
if (Klass.getTotal_count() != 1)
|
||||
error("number of objects should be 1");
|
||||
endif
|
||||
checkCount(1);
|
||||
|
||||
if (!strcmp(k2.getLabel(), "second"))
|
||||
error("wrong object label");
|
||||
endif
|
||||
|
||||
clear k2;
|
||||
if (Klass.getTotal_count() != 0)
|
||||
error("no objects should be left");
|
||||
endif
|
||||
checkCount(0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue