2 #include <boost/test/unit_test.hpp>
3 using boost::unit_test::test_suite
;
6 uint
weak_set_size(weak_set
<T
>& w
) {
8 for (typename weak_set
<T
>::iterator i
= w
.begin();
15 void test_insertion() {
16 boost::shared_ptr
<int> n(new int(8));
17 boost::shared_ptr
<int> m(new int(1));
22 BOOST_CHECK_EQUAL(2, weak_set_size(s
));
25 void test_garbage_collection() {
27 kDebug()() << "\n\ntesting garbage collection\n\n" << endl
;
28 #endif // WEAK_SET_DEBUG
32 boost::shared_ptr
<int> u(new int(37));
36 boost::shared_ptr
<int> m(new int(1));
40 boost::shared_ptr
<int> n(new int(8));
43 BOOST_CHECK_EQUAL(2, weak_set_size(s
));
48 boost::shared_ptr
<int> n(new int(42));
52 BOOST_CHECK_EQUAL(42, *s
.begin());
59 boost::shared_ptr
<int> m(new int(37));
63 BOOST_CHECK_EQUAL(0, weak_set_size(s
));
67 init_unit_test_suite(int, char*[]) {
68 test_suite
* test
= BOOST_TEST_SUITE( "Weak set test suite" );
70 test
->add(BOOST_TEST_CASE(&test_insertion
), 0);
71 test
->add(BOOST_TEST_CASE(&test_garbage_collection
), 0);
72 test
->add(BOOST_TEST_CASE(&test_get
), 0);
73 test
->add(BOOST_TEST_CASE(&test_empty
), 0);