本文整理汇总了C++中ASIO_TEST_CASE函数的典型用法代码示例。如果您正苦于以下问题:C++ ASIO_TEST_CASE函数的具体用法?C++ ASIO_TEST_CASE怎么用?C++ ASIO_TEST_CASE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ASIO_TEST_CASE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
socket1.write_some(buffer(mutable_char_buffer), ec);
socket1.write_some(buffer(const_char_buffer), ec);
socket1.write_some(null_buffers(), ec);
socket1.async_write_some(buffer(mutable_char_buffer), write_some_handler);
socket1.async_write_some(buffer(const_char_buffer), write_some_handler);
socket1.async_write_some(null_buffers(), write_some_handler);
socket1.read_some(buffer(mutable_char_buffer));
socket1.read_some(buffer(mutable_char_buffer), ec);
socket1.read_some(null_buffers(), ec);
socket1.async_read_some(buffer(mutable_char_buffer), read_some_handler);
socket1.async_read_some(null_buffers(), read_some_handler);
}
catch (std::exception&)
{
}
#endif // defined(ASIO_HAS_LOCAL_SOCKETS)
}
} // namespace local_stream_protocol_socket_compile
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"local/stream_protocol",
ASIO_TEST_CASE(local_stream_protocol_socket_compile::test)
)
示例2: buffer_copy
mv1.clear();
mv1.push_back(asio::buffer(dest_data, 7));
mv1.push_back(asio::buffer(dest_data) + 7);
cb1 = asio::buffer(source_data);
n = buffer_copy(mv1, cb1, 10);
ASIO_CHECK(n == 10);
ASIO_CHECK(memcmp(dest_data, source_data, n) == 0);
memset(dest_data, 0, sizeof(dest_data));
mv1.clear();
mv1.push_back(asio::buffer(dest_data, 7));
mv1.push_back(asio::buffer(dest_data) + 7);
cv1.clear();
cv1.push_back(asio::buffer(source_data, 8));
cv1.push_back(asio::buffer(source_data) + 8);
n = buffer_copy(mv1, cv1, 10);
ASIO_CHECK(n == 10);
ASIO_CHECK(memcmp(dest_data, source_data, n) == 0);
}
} // namespace buffer_copy_runtime
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"buffer",
ASIO_COMPILE_TEST_CASE(buffer_compile::test)
ASIO_TEST_CASE(buffer_copy_runtime::test)
)
示例3: s2
dp::socket s2(io_context);
local::connect_pair(s1, s2);
dp::socket s3(io_context);
dp::socket s4(io_context);
ec1 = local::connect_pair(s3, s4, ec2);
sp::socket s5(io_context);
sp::socket s6(io_context);
local::connect_pair(s5, s6);
sp::socket s7(io_context);
sp::socket s8(io_context);
ec1 = local::connect_pair(s7, s8, ec2);
}
catch (std::exception&)
{
}
#endif // defined(ASIO_HAS_LOCAL_SOCKETS)
}
} // namespace local_connect_pair_compile
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"local/connect_pair",
ASIO_TEST_CASE(local_connect_pair_compile::test)
)
示例4: ASIO_CHECK
ASIO_CHECK(!enable_connection_aborted3.value());
ASIO_CHECK(!static_cast<bool>(enable_connection_aborted3));
ASIO_CHECK(!enable_connection_aborted3);
tcp_acceptor.set_option(enable_connection_aborted3, ec);
ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
socket_base::enable_connection_aborted enable_connection_aborted4;
tcp_acceptor.get_option(enable_connection_aborted4, ec);
ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
ASIO_CHECK(!enable_connection_aborted4.value());
ASIO_CHECK(!static_cast<bool>(enable_connection_aborted4));
ASIO_CHECK(!enable_connection_aborted4);
// bytes_readable class.
socket_base::bytes_readable bytes_readable;
udp_sock.io_control(bytes_readable, ec);
ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
}
} // namespace socket_base_runtime
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"socket_base",
ASIO_TEST_CASE(socket_base_compile::test)
ASIO_TEST_CASE(socket_base_runtime::test)
)
示例5: ASIO_TEST_CASE
//
// descriptor_base.cpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
//
// Disable autolinking for unit tests.
#if !defined(BOOST_ALL_NO_LIB)
#define BOOST_ALL_NO_LIB 1
#endif // !defined(BOOST_ALL_NO_LIB)
// Test that header file is self-contained.
#include "asio/posix/descriptor_base.hpp"
#include "../unit_test.hpp"
ASIO_TEST_SUITE
(
"posix/descriptor_base",
ASIO_TEST_CASE(null_test)
)
示例6: test_error_code
test_error_code(asio::error::in_progress);
test_error_code(asio::error::interrupted);
test_error_code(asio::error::invalid_argument);
test_error_code(asio::error::message_size);
test_error_code(asio::error::network_down);
test_error_code(asio::error::network_reset);
test_error_code(asio::error::network_unreachable);
test_error_code(asio::error::no_descriptors);
test_error_code(asio::error::no_buffer_space);
test_error_code(asio::error::no_data);
test_error_code(asio::error::no_memory);
test_error_code(asio::error::no_permission);
test_error_code(asio::error::no_protocol_option);
test_error_code(asio::error::no_recovery);
test_error_code(asio::error::not_connected);
test_error_code(asio::error::not_socket);
test_error_code(asio::error::operation_aborted);
test_error_code(asio::error::operation_not_supported);
test_error_code(asio::error::service_not_found);
test_error_code(asio::error::shut_down);
test_error_code(asio::error::timed_out);
test_error_code(asio::error::try_again);
test_error_code(asio::error::would_block);
}
ASIO_TEST_SUITE
(
"error",
ASIO_TEST_CASE(error_test)
)
示例7: catch
socket1.write_some(null_buffers());
socket1.write_some(buffer(mutable_char_buffer), ec);
socket1.write_some(buffer(const_char_buffer), ec);
socket1.write_some(null_buffers(), ec);
socket1.async_write_some(buffer(mutable_char_buffer), write_some_handler);
socket1.async_write_some(buffer(const_char_buffer), write_some_handler);
socket1.async_write_some(null_buffers(), write_some_handler);
socket1.read_some(buffer(mutable_char_buffer));
socket1.read_some(buffer(mutable_char_buffer), ec);
socket1.read_some(null_buffers(), ec);
socket1.async_read_some(buffer(mutable_char_buffer), read_some_handler);
socket1.async_read_some(null_buffers(), read_some_handler);
}
catch (std::exception&)
{
}
}
} // namespace generic_stream_protocol_socket_compile
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"generic/stream_protocol",
ASIO_TEST_CASE(generic_stream_protocol_socket_compile::test)
)
示例8: ASIO_CHECK
ASIO_CHECK(!static_cast<bool>(v6_only3));
ASIO_CHECK(!v6_only3);
ip::v6_only v6_only4(true);
ASIO_CHECK(v6_only4.value());
ASIO_CHECK(static_cast<bool>(v6_only4));
ASIO_CHECK(!!v6_only4);
acceptor_v6.set_option(v6_only4, ec);
ASIO_CHECK(!ec);
ip::v6_only v6_only5;
acceptor_v6.get_option(v6_only5, ec);
ASIO_CHECK(!ec);
ASIO_CHECK(v6_only5.value());
ASIO_CHECK(static_cast<bool>(v6_only5));
ASIO_CHECK(!!v6_only5);
}
}
}
} // namespace ip_v6_only_runtime
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"ip/v6_only",
ASIO_TEST_CASE(ip_v6_only_compile::test)
ASIO_TEST_CASE(ip_v6_only_runtime::test)
)
示例9: catch
socket1.receive_from(null_buffers(), endpoint);
socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags);
socket1.receive_from(null_buffers(), endpoint, in_flags);
socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags, ec);
socket1.receive_from(null_buffers(), endpoint, in_flags, ec);
socket1.async_receive_from(buffer(mutable_char_buffer),
endpoint, receive_handler);
socket1.async_receive_from(null_buffers(),
endpoint, receive_handler);
socket1.async_receive_from(buffer(mutable_char_buffer),
endpoint, in_flags, receive_handler);
socket1.async_receive_from(null_buffers(),
endpoint, in_flags, receive_handler);
}
catch (std::exception&)
{
}
#endif // defined(ASIO_HAS_LOCAL_SOCKETS)
}
} // namespace local_datagram_protocol_socket_compile
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"local/datagram_protocol",
ASIO_TEST_CASE(local_datagram_protocol_socket_compile::test)
)
示例10: catch
b = (addr1 <= addr2);
(void)b;
b = (addr1 >= addr2);
(void)b;
// address I/O.
std::ostringstream os;
os << addr1;
#if !defined(BOOST_NO_STD_WSTREAMBUF)
std::wostringstream wos;
wos << addr1;
#endif // !defined(BOOST_NO_STD_WSTREAMBUF)
}
catch (std::exception&)
{
}
}
} // namespace ip_address_compile
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"ip/address",
ASIO_TEST_CASE(ip_address_compile::test)
)
示例11: ASIO_CHECK
ASIO_CHECK(sb.size() == 1);
char buf[1];
sb.sgetn(buf, 1);
ASIO_CHECK(sb.size() == 0);
sb.sputn("ab", 2);
ASIO_CHECK(sb.size() == 2);
asio::buffer_copy(sb.prepare(10), asio::buffer("cd", 2));
sb.commit(2);
ASIO_CHECK(sb.size() == 4);
}
ASIO_CHECK(sb.size() == 4);
sb.consume(4);
ASIO_CHECK(sb.size() == 0);
}
ASIO_TEST_SUITE
(
"streambuf",
ASIO_TEST_CASE(streambuf_test)
)
示例12: catch
set1.add(1);
set1.add(1, ec);
set1.remove(1);
set1.remove(1, ec);
set1.clear();
set1.clear(ec);
set1.cancel();
set1.cancel(ec);
set1.async_wait(&signal_handler);
int i = set1.async_wait(lazy);
(void)i;
}
catch (std::exception&)
{
}
}
} // namespace signal_set_compile
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"signal_set",
ASIO_TEST_CASE(signal_set_compile::test)
)
示例13: catch
bi11 = (-1) + bi11;
bi12 = (-1) + bi12;
(void)static_cast<std::ptrdiff_t>(bi13 - bi1);
(void)static_cast<std::ptrdiff_t>(bi14 - bi2);
(void)static_cast<std::ptrdiff_t>(bi15 - bi3);
(void)static_cast<std::ptrdiff_t>(bi16 - bi4);
(void)static_cast<std::ptrdiff_t>(bi17 - bi5);
(void)static_cast<std::ptrdiff_t>(bi18 - bi6);
(void)static_cast<std::ptrdiff_t>(bi19 - bi7);
(void)static_cast<std::ptrdiff_t>(bi20 - bi8);
(void)static_cast<std::ptrdiff_t>(bi21 - bi9);
(void)static_cast<std::ptrdiff_t>(bi22 - bi10);
(void)static_cast<std::ptrdiff_t>(bi23 - bi11);
(void)static_cast<std::ptrdiff_t>(bi24 - bi12);
}
catch (std::exception&)
{
}
}
} // namespace buffers_iterator_compile
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"buffers_iterator",
ASIO_TEST_CASE(buffers_iterator_compile::test)
)
示例14: catch
= handle1.native_handle();
(void)native_handle3;
handle1.cancel();
handle1.cancel(ec);
// basic_object_handle functions.
handle1.wait();
handle1.wait(ec);
handle1.async_wait(&wait_handler);
int i1 = handle1.async_wait(lazy);
(void)i1;
}
catch (std::exception&)
{
}
#endif // defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE)
}
} // namespace windows_object_handle_compile
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"windows/object_handle",
ASIO_TEST_CASE(windows_object_handle_compile::test)
)
示例15: catch
socket1.async_send(null_buffers(), in_flags, send_handler);
socket1.receive(buffer(mutable_char_buffer), out_flags);
socket1.receive(null_buffers(), out_flags);
socket1.receive(buffer(mutable_char_buffer), in_flags, out_flags);
socket1.receive(null_buffers(), in_flags, out_flags);
socket1.receive(buffer(mutable_char_buffer), in_flags, out_flags, ec);
socket1.receive(null_buffers(), in_flags, out_flags, ec);
socket1.async_receive(buffer(mutable_char_buffer), out_flags,
receive_handler);
socket1.async_receive(null_buffers(), out_flags, receive_handler);
socket1.async_receive(buffer(mutable_char_buffer), in_flags,
out_flags, receive_handler);
socket1.async_receive(null_buffers(), in_flags, out_flags, receive_handler);
}
catch (std::exception&)
{
}
}
} // namespace generic_seq_packet_protocol_socket_compile
//------------------------------------------------------------------------------
ASIO_TEST_SUITE
(
"generic/seq_packet_protocol",
ASIO_TEST_CASE(generic_seq_packet_protocol_socket_compile::test)
)