From b7e6b15e945e35c692299608adf80964c9ef84dd Mon Sep 17 00:00:00 2001 From: Alex Foster <123afoster@gmail.com> Date: Tue, 22 Oct 2024 23:12:22 -0700 Subject: [PATCH] test databuf sendstring/getstring --- test/testutils.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/testutils.cpp b/test/testutils.cpp index 5ff5ac6f..69abf8cf 100644 --- a/test/testutils.cpp +++ b/test/testutils.cpp @@ -337,6 +337,20 @@ namespace assert(getfloat(v) == -999.99f); } + void test_databuf_sendstring() + { + std::printf("Testing sendstring/getstring (databuf)\n"); + + std::array buf; + ucharbuf v(buf.data(),100); + + sendstring("test", v); + v.reset(); + std::array buf2; + getstring(buf2.data(), v, 5); + assert(std::string(buf2.data()) == std::string("test")); + } + void test_databuf_pad() { std::printf("Testing databuf<>::pad\n"); @@ -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();