1 2 // Copyright 2018 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 11 // Avoid spurious VC++ warnings 12 # define _CRT_SECURE_NO_WARNINGS 13 14 #include <boost/system/error_code.hpp> 15 #include <boost/core/lightweight_test.hpp> 16 #include <cstring> 17 18 // 19 20 namespace sys = boost::system; 21 main()22int main() 23 { 24 sys::error_category const & cat = sys::generic_category(); 25 26 // message 27 28 for( int i = -2; i < 1024; ++i ) 29 { 30 { 31 BOOST_TEST_CSTR_EQ( cat.message( i ).c_str(), std::strerror( i ) ); 32 } 33 34 { 35 char buffer[ 256 ]; 36 BOOST_TEST_CSTR_EQ( cat.message( i, buffer, sizeof( buffer ) ), std::strerror( i ) ); 37 } 38 } 39 40 return boost::report_errors(); 41 } 42