2
1
mirror of https://github.com/qpdf/qpdf.git synced 2025-01-09 01:44:16 +00:00

Add getRefcount to PointerHolder test

This commit is contained in:
Jay Berkenbilt 2019-08-30 11:58:33 -04:00
parent 646f3bc0af
commit 8c69f8495d
2 changed files with 8 additions and 0 deletions
libtests

View File

@ -63,10 +63,14 @@ int main(int argc, char* argv[])
std::cout << "hello" << std::endl; std::cout << "hello" << std::endl;
Object* o1 = new Object; Object* o1 = new Object;
ObjectHolder oh1(o1); ObjectHolder oh1(o1);
std::cout << "oh1 refcount = " << oh1.getRefcount() << std::endl;
ObjectHolder oh2(oh1); ObjectHolder oh2(oh1);
std::cout << "oh1 refcount = " << oh1.getRefcount() << std::endl;
std::cout << "oh2 refcount = " << oh2.getRefcount() << std::endl;
ObjectHolder oh3(new Object); ObjectHolder oh3(new Object);
ObjectHolder oh4; ObjectHolder oh4;
ObjectHolder oh5; ObjectHolder oh5;
std::cout << "oh5 refcount = " << oh5.getRefcount() << std::endl;
if (oh4 == oh5) if (oh4 == oh5)
{ {
std::cout << "nulls equal" << std::endl; std::cout << "nulls equal" << std::endl;

View File

@ -1,6 +1,10 @@
hello hello
created Object, id 1 created Object, id 1
oh1 refcount = 1
oh1 refcount = 2
oh2 refcount = 2
created Object, id 2 created Object, id 2
oh5 refcount = 1
nulls equal nulls equal
destroyed Object, id 2 destroyed Object, id 2
equal okay equal okay