Commit 8c69f8495de1791decff3ae37f1da2383415c144

Authored by Jay Berkenbilt
1 parent 646f3bc0

Add getRefcount to PointerHolder test

libtests/pointer_holder.cc
... ... @@ -63,10 +63,14 @@ int main(int argc, char* argv[])
63 63 std::cout << "hello" << std::endl;
64 64 Object* o1 = new Object;
65 65 ObjectHolder oh1(o1);
  66 + std::cout << "oh1 refcount = " << oh1.getRefcount() << std::endl;
66 67 ObjectHolder oh2(oh1);
  68 + std::cout << "oh1 refcount = " << oh1.getRefcount() << std::endl;
  69 + std::cout << "oh2 refcount = " << oh2.getRefcount() << std::endl;
67 70 ObjectHolder oh3(new Object);
68 71 ObjectHolder oh4;
69 72 ObjectHolder oh5;
  73 + std::cout << "oh5 refcount = " << oh5.getRefcount() << std::endl;
70 74 if (oh4 == oh5)
71 75 {
72 76 std::cout << "nulls equal" << std::endl;
... ...
libtests/qtest/ph/ph.out
1 1 hello
2 2 created Object, id 1
  3 +oh1 refcount = 1
  4 +oh1 refcount = 2
  5 +oh2 refcount = 2
3 6 created Object, id 2
  7 +oh5 refcount = 1
4 8 nulls equal
5 9 destroyed Object, id 2
6 10 equal okay
... ...