Skip to content

Commit

Permalink
test databuf<>::subbuf
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Oct 29, 2024
1 parent ab4f0e2 commit c738357
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/testutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,18 @@ namespace
}
}

void test_databuf_subbuf()
{
std::printf("Testing databuf<>::subbuf\n");

std::array<int, 4> buf{1,2,3,4};
databuf<int> d(buf.data(),4);
databuf<int> d2 = d.subbuf(2);
assert(d2.remaining() == 2);
assert(d2.getbuf()[0] == 1);
assert(d2.getbuf()[1] == 2);
}

void test_databuf_pad()
{
std::printf("Testing databuf<>::pad\n");
Expand Down Expand Up @@ -613,6 +625,7 @@ testing tools functionality\n\
test_vector_putfloat();
test_databuf_putfloat();
test_databuf_sendstring();
test_databuf_subbuf();
test_databuf_pad();
test_databuf_put();
test_databuf_get();
Expand Down

0 comments on commit c738357

Please sign in to comment.