Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / test / old / testbuffers.cc
1
2 #include <iostream>
3 using namespace std;
4
5 #include "include/bufferlist.h"
6
7
8 int main()
9 {
10
11   bufferptr p1 = new buffer("123456",6);
12   bufferptr p2 = p1;
13
14   cout << "it is '" << p1.c_str() << "'" << endl;
15
16   bufferptr p3 = new buffer("abcdef",6);
17   
18   cout << "p3 is " << p3 << endl;
19
20   bufferlist bl;
21   bl.push_back(p2);
22   bl.push_back(p1);
23   bl.push_back(p3);
24
25   cout << "bl is " << bl << endl;
26
27   cout << "len is " << bl.length() << endl;
28
29   bufferlist took;
30   bl.splice(10,4,&took);
31
32   cout << "took out " << took << "leftover is " << bl << endl;
33   //cout << "len is " << bl.length() << endl;
34
35   bufferlist bl2;
36   bl2.substr_of(bl, 3, 5);
37   cout << "bl2 is " << bl2 << endl;
38   
39
40 }