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

Method testMatrix2

test/beast/core/multi_buffer.cpp:724–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

722 }
723
724 void
725 testMatrix2()
726 {
727 using namespace test;
728 std::string const s = "Hello, world";
729 BEAST_EXPECT(s.size() == 12);
730 for(std::size_t i = 1; i < 12; ++i) {
731 for(std::size_t x = 1; x < 4; ++x) {
732 for(std::size_t y = 1; y < 4; ++y) {
733 for(std::size_t t = 1; t < 4; ++ t) {
734 for(std::size_t u = 1; u < 4; ++ u) {
735 std::size_t z = s.size() - (x + y);
736 std::size_t v = s.size() - (t + u);
737 {
738 multi_buffer b;
739 {
740 auto d = b.prepare(z);
741 BEAST_EXPECT(buffer_bytes(d) == z);
742 }
743 {
744 auto d = b.prepare(0);
745 BEAST_EXPECT(buffer_bytes(d) == 0);
746 }
747 {
748 auto d = b.prepare(y);
749 BEAST_EXPECT(buffer_bytes(d) == y);
750 }
751 {
752 auto d = b.prepare(x);
753 BEAST_EXPECT(buffer_bytes(d) == x);
754 b.commit(buffer_copy(d, net::buffer(s.data(), x)));
755 }
756 BEAST_EXPECT(b.size() == x);
757 BEAST_EXPECT(buffer_bytes(b.data()) == b.size());
758 {
759 auto d = b.prepare(x);
760 BEAST_EXPECT(buffer_bytes(d) == x);
761 }
762 {
763 auto d = b.prepare(0);
764 BEAST_EXPECT(buffer_bytes(d) == 0);
765 }
766 {
767 auto d = b.prepare(z);
768 BEAST_EXPECT(buffer_bytes(d) == z);
769 }
770 {
771 auto d = b.prepare(y);
772 BEAST_EXPECT(buffer_bytes(d) == y);
773 b.commit(buffer_copy(d, net::buffer(s.data()+x, y)));
774 }
775 b.commit(1);
776 BEAST_EXPECT(b.size() == x + y);
777 BEAST_EXPECT(buffer_bytes(b.data()) == b.size());
778 {
779 auto d = b.prepare(x);
780 BEAST_EXPECT(buffer_bytes(d) == x);
781 }

Callers

nothing calls this directly

Calls 7

buffers_to_stringFunction · 0.85
sizeMethod · 0.45
prepareMethod · 0.45
commitMethod · 0.45
dataMethod · 0.45
consumeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected