mirror of
https://github.com/ceph/ceph
synced 2025-01-20 01:51:34 +00:00
test/bufferlist.cc: retab for consistency
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
This commit is contained in:
parent
d9d3c78eb0
commit
7b9fa3c3d1
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user