tests/test_buffer.cpp

changeset 761
61d5197d612b
parent 683
aa0d09f2d81c
child 789
9b2f5661bebd
--- a/tests/test_buffer.cpp	Mon Dec 18 14:25:10 2023 +0100
+++ b/tests/test_buffer.cpp	Mon Dec 18 15:13:26 2023 +0100
@@ -344,6 +344,20 @@
     cxBufferDestroy(&buf);
 }
 
+TEST(BufferReset, Test) {
+    char space[16];
+    strcpy(space, "reset test");
+    CxBuffer buf;
+    cxBufferInit(&buf, space, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
+    buf.size = 5;
+    buf.pos = 3;
+    cxBufferReset(&buf);
+    EXPECT_EQ(memcmp(space, "reset test", 10), 0);
+    EXPECT_EQ(buf.size, 0);
+    EXPECT_EQ(buf.pos, 0);
+    cxBufferDestroy(&buf);
+}
+
 class BufferWrite : public ::testing::Test {
 protected:
     CxBuffer buf{}, target{};

mercurial