1//
2// sp_typeinfo_test.cpp
3//
4// Copyright (c) 2009 Peter Dimov
5//
6// Distributed under the Boost Software License, Version 1.0.
7// See accompanying file LICENSE_1_0.txt or copy at
8// http://www.boost.org/LICENSE_1_0.txt
9//
10
11#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
12#include <boost/core/lightweight_test.hpp>
13#include <iostream>
14
15int main()
16{
17 BOOST_TEST( BOOST_SP_TYPEID_( int ) == BOOST_SP_TYPEID_( int ) );
18 BOOST_TEST( BOOST_SP_TYPEID_( int ) != BOOST_SP_TYPEID_( long ) );
19 BOOST_TEST( BOOST_SP_TYPEID_( int ) != BOOST_SP_TYPEID_( void ) );
20
21 boost::detail::sp_typeinfo_ const & ti = BOOST_SP_TYPEID_( int );
22
23 boost::detail::sp_typeinfo_ const * pti = &BOOST_SP_TYPEID_( int );
24 BOOST_TEST( *pti == ti );
25
26 BOOST_TEST( ti == ti );
27 BOOST_TEST( !( ti != ti ) );
28 BOOST_TEST( !ti.before( ti ) );
29
30 char const * nti = ti.name();
31 std::cout << nti << std::endl;
32
33 boost::detail::sp_typeinfo_ const & tv = BOOST_SP_TYPEID_( void );
34
35 boost::detail::sp_typeinfo_ const * ptv = &BOOST_SP_TYPEID_( void );
36 BOOST_TEST( *ptv == tv );
37
38 BOOST_TEST( tv == tv );
39 BOOST_TEST( !( tv != tv ) );
40 BOOST_TEST( !tv.before( tv ) );
41
42 char const * ntv = tv.name();
43 std::cout << ntv << std::endl;
44
45 BOOST_TEST( ti != tv );
46 BOOST_TEST( !( ti == tv ) );
47
48 BOOST_TEST( ti.before( tv ) != tv.before( ti ) );
49
50 return boost::report_errors();
51}
52

source code of boost/libs/smart_ptr/test/sp_typeinfo_test.cpp