forked from boostorg/system
Add test that checks for duplicate category instances
This commit is contained in:
@ -124,6 +124,15 @@ project
|
||||
[ run header_only_test.cpp
|
||||
: : : -<library>/boost/system//boost_system <define>BOOST_NO_ANSI_APIS : header_only_test_no_ansi
|
||||
]
|
||||
[ run single_instance_test.cpp single_instance_1.cpp single_instance_2.cpp
|
||||
: : : <link>static : single_instance_test_static
|
||||
]
|
||||
[ run single_instance_test.cpp single_instance_1.cpp single_instance_2.cpp
|
||||
: : : <link>shared : single_instance_test_shared
|
||||
]
|
||||
[ run single_instance_test.cpp single_instance_1.cpp single_instance_2.cpp
|
||||
: : : -<library>/boost/system//boost_system <define>BOOST_ERROR_CODE_HEADER_ONLY : single_instance_test_header
|
||||
]
|
||||
;
|
||||
|
||||
# Quick (CI) test
|
||||
|
22
test/single_instance_1.cpp
Normal file
22
test/single_instance_1.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
// Copyright 2018 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
using namespace boost::system;
|
||||
|
||||
namespace lib1
|
||||
{
|
||||
|
||||
error_code get_system_code()
|
||||
{
|
||||
return error_code( 0, system_category() );
|
||||
}
|
||||
|
||||
error_code get_generic_code()
|
||||
{
|
||||
return error_code( 0, generic_category() );
|
||||
}
|
||||
|
||||
} // namespace lib1
|
22
test/single_instance_2.cpp
Normal file
22
test/single_instance_2.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
// Copyright 2018 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
using namespace boost::system;
|
||||
|
||||
namespace lib2
|
||||
{
|
||||
|
||||
error_code get_system_code()
|
||||
{
|
||||
return error_code( 0, system_category() );
|
||||
}
|
||||
|
||||
error_code get_generic_code()
|
||||
{
|
||||
return error_code( 0, generic_category() );
|
||||
}
|
||||
|
||||
} // namespace lib2
|
32
test/single_instance_test.cpp
Normal file
32
test/single_instance_test.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
// Copyright 2018 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
using namespace boost::system;
|
||||
|
||||
namespace lib1
|
||||
{
|
||||
|
||||
error_code get_system_code();
|
||||
error_code get_generic_code();
|
||||
|
||||
} // namespace lib1
|
||||
|
||||
namespace lib2
|
||||
{
|
||||
|
||||
error_code get_system_code();
|
||||
error_code get_generic_code();
|
||||
|
||||
} // namespace lib2
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST_EQ( lib1::get_system_code(), lib2::get_system_code() );
|
||||
BOOST_TEST_EQ( lib1::get_generic_code(), lib2::get_generic_code() );
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user