Skip to content

Commit

Permalink
test databuf::put(T*,int)
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Oct 21, 2024
1 parent 26f0902 commit 534356a
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions test/testutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,23 @@ namespace
void test_databuf_put()
{
std::printf("Testing databuf<>::put\n");
std::array<int, 4> buf;
databuf<int> d(buf.data(),4);
{
std::array<int, 4> buf;
databuf<int> d(buf.data(), 4);

d.put(3);
assert(d.length() == 1);
assert(d.buf[0] == 3);
d.put(3);
assert(d.length() == 1);
assert(d.buf[0] == 3);
}
{
std::array<int, 4> buf;
databuf<int> d(buf.data(), 4);
std::array<int, 2> buf2{1,2};
d.put(buf2.data(),2);
assert(d.length() == 2);
assert(d.buf[0] == 1);
assert(d.buf[1] == 2);
}
}

void test_databuf_get()
Expand Down

0 comments on commit 534356a

Please sign in to comment.