forked from boostorg/system
Add more 03/11 mismatch tests
This commit is contained in:
@@ -41,7 +41,11 @@ project
|
||||
{
|
||||
local result ;
|
||||
|
||||
if <toolset>gcc in $(properties) || <toolset>clang in $(properties)
|
||||
if <toolset-gcc:version>4.6 in $(properties)
|
||||
{
|
||||
result = <cxxflags>-std=c++0x ;
|
||||
}
|
||||
else if <toolset>gcc in $(properties) || <toolset>clang in $(properties)
|
||||
{
|
||||
result = <cxxflags>-std=c++11 ;
|
||||
}
|
||||
@@ -105,4 +109,16 @@ project
|
||||
[ run std_interop_test.cpp
|
||||
: : : <link>shared : std_interop_test_shared
|
||||
]
|
||||
[ run std_mismatch_test.cpp
|
||||
: : : <link>static <conditional>@cxx03 : std_mismatch_test_03
|
||||
]
|
||||
[ run std_mismatch_test.cpp
|
||||
: : : <link>shared <conditional>@cxx03 : std_mismatch_test_shared_03
|
||||
]
|
||||
[ run std_mismatch_test.cpp
|
||||
: : : <link>static <conditional>@cxx11 : std_mismatch_test_11
|
||||
]
|
||||
[ run std_mismatch_test.cpp
|
||||
: : : <link>shared <conditional>@cxx11 : std_mismatch_test_shared_11
|
||||
]
|
||||
;
|
||||
|
80
test/std_mismatch_test.cpp
Normal file
80
test/std_mismatch_test.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
|
||||
// Copyright 2017 Peter Dimov.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
//
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
// See library home page at http://www.boost.org/libs/system
|
||||
|
||||
// Avoid spurious VC++ warnings
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#if defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR)
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout
|
||||
<< "The version of the C++ standard library being used does not"
|
||||
" support header <system_error> so interoperation will not be tested.\n";
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <system_error>
|
||||
#include <cerrno>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
|
||||
static void test_generic_category()
|
||||
{
|
||||
boost::system::error_category const & bt = boost::system::generic_category();
|
||||
std::error_category const & st = bt;
|
||||
|
||||
BOOST_TEST_CSTR_EQ( bt.name(), st.name() );
|
||||
|
||||
int ev = ENOENT;
|
||||
|
||||
BOOST_TEST_EQ( bt.message( ev ), st.message( ev ) );
|
||||
|
||||
boost::system::error_code bc( ev, bt );
|
||||
std::error_code sc( bc );
|
||||
|
||||
BOOST_TEST_EQ( bc.message(), sc.message() );
|
||||
}
|
||||
|
||||
static void test_system_category()
|
||||
{
|
||||
boost::system::error_category const & bt = boost::system::system_category();
|
||||
std::error_category const & st = bt;
|
||||
|
||||
BOOST_TEST_CSTR_EQ( bt.name(), st.name() );
|
||||
|
||||
int ev = 5;
|
||||
BOOST_TEST_EQ( bt.message( ev ), st.message( ev ) );
|
||||
|
||||
boost::system::error_code bc( ev, bt );
|
||||
std::error_code sc( bc );
|
||||
|
||||
BOOST_TEST_EQ( bc.message(), sc.message() );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout
|
||||
<< "The version of the C++ standard library being used"
|
||||
" supports header <system_error> so interoperation will be tested.\n";
|
||||
|
||||
test_generic_category();
|
||||
test_system_category();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user