sp_typeinfo_test.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
  11. #include <boost/detail/lightweight_test.hpp>
  12. #include <iostream>
  13. int main()
  14. {
  15. BOOST_TEST( BOOST_SP_TYPEID_( int ) == BOOST_SP_TYPEID_( int ) );
  16. BOOST_TEST( BOOST_SP_TYPEID_( int ) != BOOST_SP_TYPEID_( long ) );
  17. BOOST_TEST( BOOST_SP_TYPEID_( int ) != BOOST_SP_TYPEID_( void ) );
  18. boost::detail::sp_typeinfo_ const & ti = BOOST_SP_TYPEID_( int );
  19. boost::detail::sp_typeinfo_ const * pti = &BOOST_SP_TYPEID_( int );
  20. BOOST_TEST( *pti == ti );
  21. BOOST_TEST( ti == ti );
  22. BOOST_TEST( !( ti != ti ) );
  23. BOOST_TEST( !ti.before( ti ) );
  24. char const * nti = ti.name();
  25. std::cout << nti << std::endl;
  26. boost::detail::sp_typeinfo_ const & tv = BOOST_SP_TYPEID_( void );
  27. boost::detail::sp_typeinfo_ const * ptv = &BOOST_SP_TYPEID_( void );
  28. BOOST_TEST( *ptv == tv );
  29. BOOST_TEST( tv == tv );
  30. BOOST_TEST( !( tv != tv ) );
  31. BOOST_TEST( !tv.before( tv ) );
  32. char const * ntv = tv.name();
  33. std::cout << ntv << std::endl;
  34. BOOST_TEST( ti != tv );
  35. BOOST_TEST( !( ti == tv ) );
  36. BOOST_TEST( ti.before( tv ) != tv.before( ti ) );
  37. return boost::report_errors();
  38. }