tests/test_buffer.cpp

changeset 761
61d5197d612b
parent 683
aa0d09f2d81c
child 789
9b2f5661bebd
equal deleted inserted replaced
760:52e49533e7b4 761:61d5197d612b
342 EXPECT_EQ(buf.size, 0); 342 EXPECT_EQ(buf.size, 0);
343 EXPECT_EQ(buf.pos, 0); 343 EXPECT_EQ(buf.pos, 0);
344 cxBufferDestroy(&buf); 344 cxBufferDestroy(&buf);
345 } 345 }
346 346
347 TEST(BufferReset, Test) {
348 char space[16];
349 strcpy(space, "reset test");
350 CxBuffer buf;
351 cxBufferInit(&buf, space, 16, cxDefaultAllocator, CX_BUFFER_DEFAULT);
352 buf.size = 5;
353 buf.pos = 3;
354 cxBufferReset(&buf);
355 EXPECT_EQ(memcmp(space, "reset test", 10), 0);
356 EXPECT_EQ(buf.size, 0);
357 EXPECT_EQ(buf.pos, 0);
358 cxBufferDestroy(&buf);
359 }
360
347 class BufferWrite : public ::testing::Test { 361 class BufferWrite : public ::testing::Test {
348 protected: 362 protected:
349 CxBuffer buf{}, target{}; 363 CxBuffer buf{}, target{};
350 364
351 void SetUp() override { 365 void SetUp() override {

mercurial