test/bufferlist.cc: retab for consistency

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
This commit is contained in:
Colin Patrick McCabe 2011-06-07 11:58:06 -07:00
parent d9d3c78eb0
commit 7b9fa3c3d1

View File

@ -8,48 +8,48 @@
TEST(BufferList, EmptyAppend) {
bufferlist bl;
bufferptr ptr;
bl.push_back(ptr);
ASSERT_EQ(bl.begin().end(), 1);
bufferlist bl;
bufferptr ptr;
bl.push_back(ptr);
ASSERT_EQ(bl.begin().end(), 1);
}
TEST(BufferList, TestPtrAppend) {
bufferlist bl;
char correct[MAX_TEST];
int curpos = 0;
int length = random() % 5 > 0 ? random() % 1000 : 0;
while (curpos + length < MAX_TEST) {
if (!length) {
bufferptr ptr;
bl.push_back(ptr);
} else {
char *current = correct + curpos;
for (int i = 0; i < length; ++i) {
char next = random() % 255;
correct[curpos++] = next;
}
bufferptr ptr(current, length);
bl.append(ptr);
}
length = random() % 5 > 0 ? random() % 1000 : 0;
}
ASSERT_EQ(memcmp(bl.c_str(), correct, curpos), 0);
bufferlist bl;
char correct[MAX_TEST];
int curpos = 0;
int length = random() % 5 > 0 ? random() % 1000 : 0;
while (curpos + length < MAX_TEST) {
if (!length) {
bufferptr ptr;
bl.push_back(ptr);
} else {
char *current = correct + curpos;
for (int i = 0; i < length; ++i) {
char next = random() % 255;
correct[curpos++] = next;
}
bufferptr ptr(current, length);
bl.append(ptr);
}
length = random() % 5 > 0 ? random() % 1000 : 0;
}
ASSERT_EQ(memcmp(bl.c_str(), correct, curpos), 0);
}
TEST(BufferList, TestDirectAppend) {
bufferlist bl;
char correct[MAX_TEST];
int curpos = 0;
int length = random() % 5 > 0 ? random() % 1000 : 0;
while (curpos + length < MAX_TEST) {
char *current = correct + curpos;
for (int i = 0; i < length; ++i) {
char next = random() % 255;
correct[curpos++] = next;
}
bl.append(current, length);
length = random() % 5 > 0 ? random() % 1000 : 0;
}
ASSERT_EQ(memcmp(bl.c_str(), correct, curpos), 0);
bufferlist bl;
char correct[MAX_TEST];
int curpos = 0;
int length = random() % 5 > 0 ? random() % 1000 : 0;
while (curpos + length < MAX_TEST) {
char *current = correct + curpos;
for (int i = 0; i < length; ++i) {
char next = random() % 255;
correct[curpos++] = next;
}
bl.append(current, length);
length = random() % 5 > 0 ? random() % 1000 : 0;
}
ASSERT_EQ(memcmp(bl.c_str(), correct, curpos), 0);
}