]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/system/test/warnings_test.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / system / test / warnings_test.cpp
CommitLineData
92f5a8d4
TL
1
2// Copyright 2017, 2019 Peter Dimov.
3//
4// Distributed under the Boost Software License, Version 1.0.
5//
6// See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt
8
9// See library home page at http://www.boost.org/libs/system
10
20effc67
TL
11#if defined(__GNUC__) && __GNUC__ >= 5 && __cplusplus >= 201103L
12# pragma GCC diagnostic error "-Wsuggest-override"
13#endif
14
92f5a8d4
TL
15#include <boost/config.hpp>
16
17#if defined( BOOST_GCC ) && BOOST_GCC < 40600
18#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
19#endif
20
20effc67 21#include <boost/system/system_error.hpp>
92f5a8d4
TL
22#include <boost/system/error_code.hpp>
23#include <boost/core/lightweight_test.hpp>
24#include <cerrno>
25
26int main()
27{
28 boost::system::error_category const & bt = boost::system::generic_category();
29
30 int ev = ENOENT;
31
32 boost::system::error_code bc( ev, bt );
33
34 BOOST_TEST_EQ( bc.value(), ev );
35 BOOST_TEST_EQ( &bc.category(), &bt );
36
37 boost::system::error_condition bn = bt.default_error_condition( ev );
38
39 BOOST_TEST_EQ( bn.value(), ev );
40 BOOST_TEST_EQ( &bn.category(), &bt );
41
42 BOOST_TEST( bt.equivalent( ev, bn ) );
43
44 BOOST_TEST( bc == bn );
45
20effc67
TL
46 boost::system::system_error x( bc, "prefix" );
47
48 BOOST_TEST_EQ( x.code(), bc );
49 BOOST_TEST_EQ( std::string( x.what() ), "prefix: " + bc.message() );
50
92f5a8d4
TL
51 return boost::report_errors();
52}