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

Method testMatrix1

test/beast/core/multi_buffer.cpp:683–722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

681 }
682
683 void
684 testMatrix1()
685 {
686 string_view s = "Hello, world";
687 BEAST_EXPECT(s.size() == 12);
688 for(std::size_t i = 1; i < 12; ++i) {
689 for(std::size_t x = 1; x < 4; ++x) {
690 for(std::size_t y = 1; y < 4; ++y) {
691 std::size_t z = s.size() - (x + y);
692 {
693 multi_buffer b;
694 b.commit(net::buffer_copy(
695 b.prepare(x), net::buffer(s.data(), x)));
696 b.commit(net::buffer_copy(
697 b.prepare(y), net::buffer(s.data()+x, y)));
698 b.commit(net::buffer_copy(
699 b.prepare(z), net::buffer(s.data()+x+y, z)));
700 BEAST_EXPECT(buffers_to_string(b.data()) == s);
701 {
702 multi_buffer mb2{b};
703 BEAST_EXPECT(eq(b, mb2));
704 }
705 {
706 multi_buffer mb2;
707 mb2 = b;
708 BEAST_EXPECT(eq(b, mb2));
709 }
710 {
711 multi_buffer mb2{std::move(b)};
712 BEAST_EXPECT(buffers_to_string(mb2.data()) == s);
713 BEAST_EXPECT(b.size() == 0);
714 BEAST_EXPECT(buffer_bytes(b.data()) == 0);
715 b = std::move(mb2);
716 BEAST_EXPECT(buffers_to_string(b.data()) == s);
717 BEAST_EXPECT(mb2.size() == 0);
718 BEAST_EXPECT(buffer_bytes(mb2.data()) == 0);
719 }
720 }
721 }}}
722 }
723
724 void
725 testMatrix2()

Callers

nothing calls this directly

Calls 6

buffers_to_stringFunction · 0.85
moveClass · 0.85
sizeMethod · 0.45
commitMethod · 0.45
prepareMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected