Skip to content

Commit

Permalink
test databuf sendstring/getstring
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Oct 23, 2024
1 parent b700043 commit b7e6b15
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/testutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,20 @@ namespace
assert(getfloat(v) == -999.99f);
}

void test_databuf_sendstring()
{
std::printf("Testing sendstring/getstring (databuf)\n");

std::array<uchar, 100> buf;
ucharbuf v(buf.data(),100);

sendstring("test", v);
v.reset();
std::array<char, 100> buf2;
getstring(buf2.data(), v, 5);
assert(std::string(buf2.data()) == std::string("test"));
}

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

0 comments on commit b7e6b15

Please sign in to comment.