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

Method failMatrix

test/beast/http/read.cpp:50–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48public:
49 template<bool isRequest>
50 void
51 failMatrix(char const* s, yield_context do_yield)
52 {
53 static std::size_t constexpr limit = 100;
54 std::size_t n;
55 auto const len = strlen(s);
56 for(n = 0; n < limit; ++n)
57 {
58 multi_buffer b;
59 b.commit(net::buffer_copy(
60 b.prepare(len), net::buffer(s, len)));
61 test::fail_count fc(n);
62 test::stream ts{ioc_, fc};
63 test_parser<isRequest> p(fc);
64 error_code ec = test::error::test_failure;
65 ts.close_remote();
66 read(ts, b, p, ec);
67 if(! ec)
68 break;
69 }
70 BEAST_EXPECT(n < limit);
71 for(n = 0; n < limit; ++n)
72 {
73 static std::size_t constexpr pre = 10;
74 multi_buffer b;
75 b.commit(net::buffer_copy(
76 b.prepare(pre), net::buffer(s, pre)));
77 test::fail_count fc(n);
78 test::stream ts{ioc_, fc,
79 std::string(s + pre, len - pre)};
80 test_parser<isRequest> p(fc);
81 error_code ec = test::error::test_failure;
82 ts.close_remote();
83 read(ts, b, p, ec);
84 if(! ec)
85 break;
86 }
87 BEAST_EXPECT(n < limit);
88 for(n = 0; n < limit; ++n)
89 {
90 multi_buffer b;
91 b.commit(net::buffer_copy(
92 b.prepare(len), net::buffer(s, len)));
93 test::fail_count fc(n);
94 test::stream ts{ioc_, fc};
95 test_parser<isRequest> p(fc);
96 error_code ec = test::error::test_failure;
97 ts.close_remote();
98 async_read(ts, b, p, do_yield[ec]);
99 if(! ec)
100 break;
101 }
102 BEAST_EXPECT(n < limit);
103 for(n = 0; n < limit; ++n)
104 {
105 multi_buffer b;
106 b.commit(net::buffer_copy(
107 b.prepare(len), net::buffer(s, len)));

Callers

nothing calls this directly

Calls 5

async_read_headerFunction · 0.85
readFunction · 0.50
async_readFunction · 0.50
commitMethod · 0.45
prepareMethod · 0.45

Tested by

no test coverage detected