Esempio n. 1
0
TEST(GTestStringBuffer, TestCapacity) {
    StringBuffer::Ptr sb = StringBuffer::create(1024);
    ASSERT_LE(1024, sb->capacity());

    sb->ensureCapacity(2048);
    ASSERT_LE(2048, sb->capacity());
    ASSERT_EQ(0, sb->length());
}
Esempio n. 2
0
TEST(GTestStringBuffer, TestClear) {
    String::CPtr s = String::create("abc");
    StringBuffer::Ptr sb = StringBuffer::create(s);
    sb->ensureCapacity(1024);
    Size capacity = sb->capacity();
    ASSERT_EQ(3, sb->length());

    sb->clear();
    ASSERT_EQ(0, sb->length());
    ASSERT_EQ(capacity, sb->capacity());
}