forked from boostorg/smart_ptr
Test make_shared/allocate_shared in dll_test too
This commit is contained in:
@ -6,7 +6,9 @@
|
|||||||
// http://www.boost.org/LICENSE_1_0.txt
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <boost/make_shared.hpp>
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#if defined(DLL_TEST_DYN_LINK)
|
#if defined(DLL_TEST_DYN_LINK)
|
||||||
# define EXPORT BOOST_SYMBOL_EXPORT
|
# define EXPORT BOOST_SYMBOL_EXPORT
|
||||||
@ -14,7 +16,27 @@
|
|||||||
# define EXPORT
|
# define EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXPORT boost::shared_ptr<int> dll_test()
|
EXPORT boost::shared_ptr<int> dll_test_41()
|
||||||
{
|
{
|
||||||
return boost::shared_ptr<int>( new int( 42 ) );
|
return boost::shared_ptr<int>( new int( 41 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT boost::shared_ptr<int> dll_test_42()
|
||||||
|
{
|
||||||
|
return boost::make_shared<int>( 42 );
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT boost::shared_ptr<int> dll_test_43()
|
||||||
|
{
|
||||||
|
return boost::allocate_shared<int>( std::allocator<int>(), 43 );
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT boost::shared_ptr<int[]> dll_test_44()
|
||||||
|
{
|
||||||
|
return boost::make_shared<int[1]>( 44 );
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT boost::shared_ptr<int[]> dll_test_45()
|
||||||
|
{
|
||||||
|
return boost::allocate_shared<int[1]>( std::allocator<int>(), 45 );
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,38 @@
|
|||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/core/lightweight_test.hpp>
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
boost::shared_ptr<int> dll_test();
|
boost::shared_ptr<int> dll_test_41();
|
||||||
|
boost::shared_ptr<int> dll_test_42();
|
||||||
|
boost::shared_ptr<int> dll_test_43();
|
||||||
|
boost::shared_ptr<int[]> dll_test_44();
|
||||||
|
boost::shared_ptr<int[]> dll_test_45();
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
boost::shared_ptr<int> p1 = dll_test();
|
{
|
||||||
|
boost::shared_ptr<int> p = dll_test_41();
|
||||||
|
BOOST_TEST_EQ( *p, 41 );
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_TEST_EQ( *p1, 42 );
|
{
|
||||||
|
boost::shared_ptr<int> p = dll_test_42();
|
||||||
|
BOOST_TEST_EQ( *p, 42 );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
boost::shared_ptr<int> p = dll_test_43();
|
||||||
|
BOOST_TEST_EQ( *p, 43 );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
boost::shared_ptr<int[]> p = dll_test_44();
|
||||||
|
BOOST_TEST_EQ( p[0], 44 );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
boost::shared_ptr<int[]> p = dll_test_45();
|
||||||
|
BOOST_TEST_EQ( p[0], 45 );
|
||||||
|
}
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user