Fix test to compare typeinfo
rather than its address
This commit is contained in:
parent
3c9c9603ad
commit
4dc12c59bd
@ -11,7 +11,7 @@
|
||||
# define EXPORT
|
||||
#endif
|
||||
|
||||
EXPORT boost::core::typeinfo const * get_typeid_int()
|
||||
EXPORT boost::core::typeinfo const & get_typeid_int()
|
||||
{
|
||||
return &BOOST_CORE_TYPEID( int );
|
||||
return BOOST_CORE_TYPEID( int );
|
||||
}
|
||||
|
@ -5,10 +5,22 @@
|
||||
#include <boost/core/typeinfo.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
boost::core::typeinfo const * get_typeid_int();
|
||||
boost::core::typeinfo const & get_typeid_int();
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST_EQ( get_typeid_int(), &BOOST_CORE_TYPEID( int ) );
|
||||
boost::core::typeinfo const & ti = BOOST_CORE_TYPEID( int );
|
||||
boost::core::typeinfo const & tf = BOOST_CORE_TYPEID( float );
|
||||
|
||||
boost::core::typeinfo const & ti2 = get_typeid_int();
|
||||
|
||||
BOOST_TEST( ti2 == ti );
|
||||
BOOST_TEST( ti2 != tf );
|
||||
|
||||
BOOST_TEST( !ti2.before( ti ) );
|
||||
BOOST_TEST( !ti.before( ti2 ) );
|
||||
|
||||
BOOST_TEST( ti2.before( tf ) != tf.before( ti2 ) );
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user