mirror of
https://github.com/boostorg/core.git
synced 2025-07-29 12:27:42 +02:00
Add test for BOOST_CORE_TYPEID in a library
This commit is contained in:
@ -130,5 +130,13 @@ run empty_value_size_test.cpp ;
|
||||
run quick_exit_test.cpp ;
|
||||
run-fail quick_exit_fail.cpp ;
|
||||
|
||||
lib lib_typeid : lib_typeid.cpp : <link>shared:<define>LIB_TYPEID_DYN_LINK=1 ;
|
||||
|
||||
run test_lib_typeid.cpp lib_typeid : : : <link>shared : test_lib_typeid_shared ;
|
||||
run test_lib_typeid.cpp lib_typeid : : : <link>static : test_lib_typeid_static ;
|
||||
|
||||
run test_lib_typeid.cpp lib_typeid : : : <link>shared <rtti>off : test_lib_typeid_shared_no_rtti ;
|
||||
run test_lib_typeid.cpp lib_typeid : : : <link>static <rtti>off : test_lib_typeid_static_no_rtti ;
|
||||
|
||||
use-project /boost/core/swap : ./swap ;
|
||||
build-project ./swap ;
|
||||
|
17
test/lib_typeid.cpp
Normal file
17
test/lib_typeid.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
// Copyright 2018 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/core/typeinfo.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(LIB_TYPEID_DYN_LINK)
|
||||
# define EXPORT BOOST_SYMBOL_EXPORT
|
||||
#else
|
||||
# define EXPORT
|
||||
#endif
|
||||
|
||||
EXPORT boost::core::typeinfo const * get_typeid_int()
|
||||
{
|
||||
return &BOOST_CORE_TYPEID( int );
|
||||
}
|
14
test/test_lib_typeid.cpp
Normal file
14
test/test_lib_typeid.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
// Copyright 2018 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/core/typeinfo.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
boost::core::typeinfo const * get_typeid_int();
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST_EQ( get_typeid_int(), &BOOST_CORE_TYPEID( int ) );
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user