3 #if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
6 #include "cppunit/cppunit_proxy.h"
8 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
12 class RefWrapperTest
:
13 public CPPUNIT_NS::TestCase
15 CPPUNIT_TEST_SUITE(RefWrapperTest
);
18 CPPUNIT_TEST_SUITE_END();
25 CPPUNIT_TEST_SUITE_REGISTRATION(RefWrapperTest
);
27 void RefWrapperTest::ref()
29 typedef std::tr1::reference_wrapper
<int> rr_type
;
31 CPPUNIT_CHECK( (::boost::is_convertible
<rr_type
, int&>::value
) );
32 CPPUNIT_CHECK( (::boost::is_same
<rr_type::type
, int>::value
) );
37 rr_type r1
= std::tr1::ref(i
);
39 CPPUNIT_CHECK( r1
.get() == 1 );
41 r1
= std::tr1::ref(j
);
43 CPPUNIT_CHECK( r1
.get() == 2 );
47 CPPUNIT_CHECK( r1
.get() == 2 );
51 CPPUNIT_CHECK( r1
.get() == 4 );
55 CPPUNIT_CHECK( j
== 5 );
58 void RefWrapperTest::cref()
60 typedef std::tr1::reference_wrapper
<const int> crr_type
;
62 CPPUNIT_CHECK( (::boost::is_convertible
<crr_type
, const int&>::value
) );
63 CPPUNIT_CHECK( (::boost::is_same
<crr_type::type
, const int>::value
) );
68 crr_type r1
= std::tr1::cref(i
);
70 CPPUNIT_CHECK( r1
.get() == 1 );
72 r1
= std::tr1::cref(j
);
74 CPPUNIT_CHECK( r1
.get() == 2 );
78 CPPUNIT_CHECK( r1
.get() == 2 );
82 CPPUNIT_CHECK( r1
.get() == 4 );
85 #endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */