MCPcopy Create free account
hub / github.com/boostorg/beast / testMembers

Method testMembers

test/beast/core/basic_stream.cpp:1072–1191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1070 }
1071
1072 void
1073 testMembers()
1074 {
1075 using stream_type = basic_stream<tcp,
1076 net::io_context::executor_type>;
1077
1078 class handler
1079 {
1080 bool pass_ = false;
1081 boost::optional<error_code> expected_ = {};
1082
1083 public:
1084 ~handler()
1085 {
1086 BEAST_EXPECT(pass_);
1087 }
1088
1089 handler()
1090 : expected_(error_code{})
1091 {
1092 }
1093
1094 explicit
1095 handler(error_code expected)
1096 : expected_(expected)
1097 {
1098 }
1099
1100 explicit
1101 handler(boost::none_t)
1102 {
1103 }
1104
1105 handler(handler&& other)
1106 : pass_(boost::exchange(other.pass_, true))
1107 , expected_(other.expected_)
1108 {
1109 }
1110
1111 void operator()(error_code ec, std::size_t)
1112 {
1113 pass_ = true;
1114 if(expected_)
1115 BEAST_EXPECTS(
1116 ec == expected_, ec.message());
1117 }
1118 };
1119
1120 auto const ep = net::ip::tcp::endpoint(
1121 net::ip::make_address("127.0.0.1"), 0);
1122
1123 char buf[4];
1124 net::io_context ioc;
1125 auto mb = net::buffer(buf);
1126 std::memset(buf, 0, sizeof(buf));
1127
1128 // cancel
1129

Callers

nothing calls this directly

Calls 7

local_endpointMethod · 0.80
async_read_someMethod · 0.80
handlerClass · 0.70
teardownFunction · 0.50
async_teardownFunction · 0.50
runMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected