Add equality tests using two libraries returning equivalent error codes, to check that the categories have sigle instances

This commit is contained in:
Peter Dimov
2018-01-21 22:29:58 +02:00
parent ecb77edb81
commit 3ee2c53cbf
3 changed files with 25 additions and 6 deletions

View File

@ -21,6 +21,9 @@ project
<link>static:<define>BOOST_SYSTEM_STATIC_LINK=1
;
lib single_instance_lib1 : single_instance_1.cpp : <link>shared:<define>SINGLE_INSTANCE_DYN_LINK ;
lib single_instance_lib2 : single_instance_2.cpp : <link>shared:<define>SINGLE_INSTANCE_DYN_LINK ;
rule cxx03 ( properties * )
{
local result ;
@ -107,6 +110,8 @@ project
[ system-run- std_interop_test.cpp ]
[ system-run std_mismatch_test.cpp ]
[ system-run single_instance_test.cpp single_instance_1.cpp single_instance_2.cpp ]
[ run single_instance_test.cpp single_instance_lib1 single_instance_lib2 : : : <link>static : single_instance_lib_static ]
[ run single_instance_test.cpp single_instance_lib1 single_instance_lib2 : : : <link>shared : single_instance_lib_shared ]
[ system-run before_main_test.cpp ]
;

View File

@ -2,19 +2,26 @@
// Copyright 2018 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
#include <boost/system/error_code.hpp>
#include <boost/config.hpp>
#if defined(SINGLE_INSTANCE_DYN_LINK) && defined(BOOST_HAS_DECLSPEC)
# define EXPORT __declspec(dllexport)
#else
# define EXPORT
#endif
#include <boost/system/error_code.hpp>
using namespace boost::system;
namespace lib1
{
error_code get_system_code()
EXPORT error_code get_system_code()
{
return error_code( 0, system_category() );
}
error_code get_generic_code()
EXPORT error_code get_generic_code()
{
return error_code( 0, generic_category() );
}

View File

@ -2,19 +2,26 @@
// Copyright 2018 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
#include <boost/system/error_code.hpp>
#include <boost/config.hpp>
#if defined(SINGLE_INSTANCE_DYN_LINK) && defined(BOOST_HAS_DECLSPEC)
# define EXPORT __declspec(dllexport)
#else
# define EXPORT
#endif
#include <boost/system/error_code.hpp>
using namespace boost::system;
namespace lib2
{
error_code get_system_code()
EXPORT error_code get_system_code()
{
return error_code( 0, system_category() );
}
error_code get_generic_code()
EXPORT error_code get_generic_code()
{
return error_code( 0, generic_category() );
}