From 3ee2c53cbf354403797f0fd660e0d92ff6156b52 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 21 Jan 2018 22:29:58 +0200 Subject: [PATCH] Add equality tests using two libraries returning equivalent error codes, to check that the categories have sigle instances --- test/Jamfile.v2 | 5 +++++ test/single_instance_1.cpp | 13 ++++++++++--- test/single_instance_2.cpp | 13 ++++++++++--- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 612d475..c7ce094 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -21,6 +21,9 @@ project static:BOOST_SYSTEM_STATIC_LINK=1 ; + lib single_instance_lib1 : single_instance_1.cpp : shared:SINGLE_INSTANCE_DYN_LINK ; + lib single_instance_lib2 : single_instance_2.cpp : shared: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 : : : static : single_instance_lib_static ] + [ run single_instance_test.cpp single_instance_lib1 single_instance_lib2 : : : shared : single_instance_lib_shared ] [ system-run before_main_test.cpp ] ; diff --git a/test/single_instance_1.cpp b/test/single_instance_1.cpp index 35a7240..3bee8a8 100644 --- a/test/single_instance_1.cpp +++ b/test/single_instance_1.cpp @@ -2,19 +2,26 @@ // Copyright 2018 Peter Dimov. // Distributed under the Boost Software License, Version 1.0. -#include +#include +#if defined(SINGLE_INSTANCE_DYN_LINK) && defined(BOOST_HAS_DECLSPEC) +# define EXPORT __declspec(dllexport) +#else +# define EXPORT +#endif + +#include 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() ); } diff --git a/test/single_instance_2.cpp b/test/single_instance_2.cpp index 91cbe24..6a3cc63 100644 --- a/test/single_instance_2.cpp +++ b/test/single_instance_2.cpp @@ -2,19 +2,26 @@ // Copyright 2018 Peter Dimov. // Distributed under the Boost Software License, Version 1.0. -#include +#include +#if defined(SINGLE_INSTANCE_DYN_LINK) && defined(BOOST_HAS_DECLSPEC) +# define EXPORT __declspec(dllexport) +#else +# define EXPORT +#endif + +#include 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() ); }