Files
system/test/std_interop_test16.cpp

59 lines
1.1 KiB
C++
Raw Normal View History

2023-01-19 05:46:11 +02:00
// Copyright 2023 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
#define _CRT_SECURE_NO_WARNINGS
#include <boost/system/error_category.hpp>
2023-01-19 05:46:11 +02:00
#include <boost/config/pragma_message.hpp>
#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 <boost/core/lightweight_test.hpp>
#include <system_error>
// get_user_category
class user_category: public boost::system::error_category
{
public:
virtual const char * name() const BOOST_NOEXCEPT
{
return "user";
}
virtual std::string message( int ev ) const
{
char buffer[ 256 ];
std::sprintf( buffer, "user message %d", ev );
return buffer;
}
};
boost::system::error_category const & get_user_category()
{
static user_category instance;
return instance;
}
//
2023-01-19 05:46:11 +02:00
bool init_lwt = (boost::core::lwt_init(), true);
std::error_category const & cat = get_user_category();
2023-01-19 05:46:11 +02:00
int main()
{
BOOST_TEST_CSTR_EQ( cat.name(), "user" );
2023-01-19 05:46:11 +02:00
return boost::report_errors();
}
#endif