forked from boostorg/system
Add error_condition.hpp
This commit is contained in:
13
include/boost/system/error_condition.hpp
Normal file
13
include/boost/system/error_condition.hpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef BOOST_SYSTEM_ERROR_CONDITION_HPP_INCLUDED
|
||||||
|
#define BOOST_SYSTEM_ERROR_CONDITION_HPP_INCLUDED
|
||||||
|
|
||||||
|
// Copyright 2020 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
//
|
||||||
|
// See library home page at http://www.boost.org/libs/system
|
||||||
|
|
||||||
|
#include <boost/system/detail/error_condition.hpp>
|
||||||
|
#include <boost/system/detail/error_category_impl.hpp>
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_SYSTEM_ERROR_CONDITION_HPP_INCLUDED
|
@ -78,3 +78,4 @@ run is_error_code_enum_test.cpp ;
|
|||||||
run is_error_condition_enum_test.cpp ;
|
run is_error_condition_enum_test.cpp ;
|
||||||
run errc_test.cpp ;
|
run errc_test.cpp ;
|
||||||
run error_category_test2.cpp ;
|
run error_category_test2.cpp ;
|
||||||
|
run error_condition_test.cpp ;
|
||||||
|
31
test/error_condition_test.cpp
Normal file
31
test/error_condition_test.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright 2020 Peter Dimov.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/system/error_condition.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
namespace sys = boost::system;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
sys::error_condition en;
|
||||||
|
|
||||||
|
BOOST_TEST_EQ( en.value(), 0 );
|
||||||
|
BOOST_TEST( !en );
|
||||||
|
|
||||||
|
sys::error_condition en2( en );
|
||||||
|
|
||||||
|
BOOST_TEST( en == en2 );
|
||||||
|
BOOST_TEST_NOT( en != en2 );
|
||||||
|
|
||||||
|
en2.assign( 1, en.category() );
|
||||||
|
|
||||||
|
BOOST_TEST_EQ( en2.value(), 1 );
|
||||||
|
BOOST_TEST( en2 );
|
||||||
|
|
||||||
|
BOOST_TEST_NOT( en == en2 );
|
||||||
|
BOOST_TEST( en != en2 );
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
Reference in New Issue
Block a user