forked from boostorg/system
Add std_interop_test5
This commit is contained in:
@ -93,3 +93,4 @@ boost_test(TYPE run SOURCES snprintf_test.cpp)
|
|||||||
boost_test(TYPE run SOURCES std_interop_test2.cpp)
|
boost_test(TYPE run SOURCES std_interop_test2.cpp)
|
||||||
boost_test(TYPE run SOURCES std_interop_test3.cpp)
|
boost_test(TYPE run SOURCES std_interop_test3.cpp)
|
||||||
boost_test(TYPE run SOURCES std_interop_test4.cpp)
|
boost_test(TYPE run SOURCES std_interop_test4.cpp)
|
||||||
|
boost_test(TYPE run SOURCES std_interop_test5.cpp)
|
||||||
|
@ -97,3 +97,4 @@ run snprintf_test.cpp ;
|
|||||||
run std_interop_test2.cpp ;
|
run std_interop_test2.cpp ;
|
||||||
run std_interop_test3.cpp ;
|
run std_interop_test3.cpp ;
|
||||||
run std_interop_test4.cpp ;
|
run std_interop_test4.cpp ;
|
||||||
|
run std_interop_test5.cpp ;
|
||||||
|
96
test/std_interop_test5.cpp
Normal file
96
test/std_interop_test5.cpp
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
// Copyright 2021 Peter Dimov.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/system/error_code.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
#include <boost/config/pragma_message.hpp>
|
||||||
|
#include <cerrno>
|
||||||
|
|
||||||
|
#if !defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
|
||||||
|
|
||||||
|
BOOST_PRAGMA_MESSAGE( "BOOST_SYSTEM_HAS_SYSTEM_ERROR not defined, test will be skipped" )
|
||||||
|
int main() {}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <system_error>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
std::error_code e1;
|
||||||
|
std::error_condition en = e1.default_error_condition();
|
||||||
|
|
||||||
|
BOOST_TEST( e1 == en );
|
||||||
|
|
||||||
|
boost::system::error_code e2( e1 );
|
||||||
|
|
||||||
|
BOOST_TEST_EQ( e2, e1 );
|
||||||
|
BOOST_TEST_NOT( e2 != e1 );
|
||||||
|
|
||||||
|
BOOST_TEST( e2 == en );
|
||||||
|
|
||||||
|
std::error_code e3( e2 );
|
||||||
|
|
||||||
|
BOOST_TEST( e3 == en );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::error_code e1( 5, std::system_category() );
|
||||||
|
std::error_condition en = e1.default_error_condition();
|
||||||
|
|
||||||
|
BOOST_TEST( e1 == en );
|
||||||
|
|
||||||
|
boost::system::error_code e2( e1 );
|
||||||
|
|
||||||
|
BOOST_TEST_EQ( e2, e1 );
|
||||||
|
BOOST_TEST_NOT( e2 != e1 );
|
||||||
|
|
||||||
|
BOOST_TEST( e2 == en );
|
||||||
|
|
||||||
|
std::error_code e3( e2 );
|
||||||
|
|
||||||
|
BOOST_TEST( e3 == en );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::error_code e1( 0, std::generic_category() );
|
||||||
|
std::error_condition en = e1.default_error_condition();
|
||||||
|
|
||||||
|
BOOST_TEST( e1 == en );
|
||||||
|
|
||||||
|
boost::system::error_code e2( e1 );
|
||||||
|
|
||||||
|
BOOST_TEST_EQ( e2, e1 );
|
||||||
|
BOOST_TEST_NOT( e2 != e1 );
|
||||||
|
|
||||||
|
BOOST_TEST( e2 == en );
|
||||||
|
|
||||||
|
std::error_code e3( e2 );
|
||||||
|
|
||||||
|
BOOST_TEST( e3 == en );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::error_code e1( 5, std::generic_category() );
|
||||||
|
std::error_condition en = e1.default_error_condition();
|
||||||
|
|
||||||
|
BOOST_TEST( e1 == en );
|
||||||
|
|
||||||
|
boost::system::error_code e2( e1 );
|
||||||
|
|
||||||
|
BOOST_TEST_EQ( e2, e1 );
|
||||||
|
BOOST_TEST_NOT( e2 != e1 );
|
||||||
|
|
||||||
|
BOOST_TEST( e2 == en );
|
||||||
|
|
||||||
|
std::error_code e3( e2 );
|
||||||
|
|
||||||
|
BOOST_TEST( e3 == en );
|
||||||
|
}
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user