Scroom  0.14
basic-assumptions.cc File Reference
#include <boost/shared_ptr.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/weak_ptr.hpp>
Include dependency graph for basic-assumptions.cc:

Functions

 BOOST_AUTO_TEST_CASE (weak_pointer_equality)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE()

BOOST_AUTO_TEST_CASE ( weak_pointer_equality  )
17 {
18  {
19  boost::weak_ptr<int> a;
20  boost::weak_ptr<int> b;
21  // Uninitialised weak pointers are equal
22  BOOST_CHECK(!(a < b) && !(b < a));
23 
24  // Pointers to something that has been deleted are different from
25  // uninitialized ones
26  boost::shared_ptr<int> c = boost::shared_ptr<int>(new int());
27  a = c;
28  BOOST_CHECK((a < b) || (b < a));
29  c.reset();
30  BOOST_CHECK((a < b) || (b < a));
31 
32  // Pointers to something that has been deleted are still equal
33  c = boost::shared_ptr<int>(new int());
34  a = c;
35  b = c;
36  BOOST_CHECK(!(a < b) && !(b < a));
37  c.reset();
38  BOOST_CHECK(!(a < b) && !(b < a));
39  BOOST_CHECK(!a.lock());
40  BOOST_CHECK(!b.lock());
41  BOOST_CHECK_EQUAL(a.lock(), b.lock());
42 
43  // Locking something that has been deleted equals an uninitialized pointer (?)
44  boost::shared_ptr<int> const d;
45  BOOST_CHECK_EQUAL(a.lock(), d);
46  }
47 }
Here is the call graph for this function:
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(sample.expectedColors, originalColormap->colors.size())
b
static void b(const B::Ptr &)
Definition: gtkhelper-tests.cc:32