test/test_buffer.cpp

changeset 566
d3100c987a39
parent 565
d756746ea94f
child 567
f90a7cfe2480
equal deleted inserted replaced
565:d756746ea94f 566:d3100c987a39
428 // remember: whole elements are discarded if they do not fit 428 // remember: whole elements are discarded if they do not fit
429 EXPECT_EQ(written, 3); 429 EXPECT_EQ(written, 3);
430 EXPECT_EQ(buf.size, 9); 430 EXPECT_EQ(buf.size, 9);
431 EXPECT_EQ(buf.pos, 9); 431 EXPECT_EQ(buf.pos, 9);
432 EXPECT_GE(buf.capacity, 9); 432 EXPECT_GE(buf.capacity, 9);
433 EXPECT_EQ(memcmp(buf.space, "pretester\0", 10), 0); 433 EXPECT_EQ(memcmp(buf.space, "pretester", 9), 0);
434 } 434 }
435 435
436 TEST_F(BufferWrite, PutcWrapperFit) { 436 TEST_F(BufferWrite, PutcWrapperFit) {
437 ASSERT_EQ(buf.capacity, 8); 437 ASSERT_EQ(buf.capacity, 8);
438 ASSERT_EQ(buf.pos, 4); 438 ASSERT_EQ(buf.pos, 4);
465 int c = cxBufferPut(&buf, 0x200 | 'a'); 465 int c = cxBufferPut(&buf, 0x200 | 'a');
466 EXPECT_EQ(c, 'a'); 466 EXPECT_EQ(c, 'a');
467 EXPECT_EQ(buf.size, 9); 467 EXPECT_EQ(buf.size, 9);
468 EXPECT_EQ(buf.pos, 9); 468 EXPECT_EQ(buf.pos, 9);
469 EXPECT_GE(buf.capacity, 9); 469 EXPECT_GE(buf.capacity, 9);
470 EXPECT_EQ(memcmp(buf.space, "prep\0\0\0\0a\0", 10), 0); 470 EXPECT_EQ(memcmp(buf.space, "prep\0\0\0\0a", 9), 0);
471 } 471 }
472 472
473 TEST_F(BufferWrite, PutStringWrapperFit) { 473 TEST_F(BufferWrite, PutStringWrapperFit) {
474 const char *data = "test"; 474 const char *data = "test";
475 ASSERT_EQ(buf.capacity, 8); 475 ASSERT_EQ(buf.capacity, 8);

mercurial