proxygen
LoggingTests.cpp File Reference

Go to the source code of this file.

Classes

class  LoggingTests
 

Functions

 TEST_F (LoggingTests, Refset)
 
 TEST_F (LoggingTests, DumpHeaderVector)
 
 TEST_F (LoggingTests, PrintDelta)
 
 TEST_F (LoggingTests, DumpBin)
 

Function Documentation

TEST_F ( LoggingTests  ,
Refset   
)

Definition at line 25 of file LoggingTests.cpp.

References EXPECT_EQ.

25  {
26  list<uint32_t> refset;
27  refset.push_back(3);
28  refset.push_back(5);
29  stringstream out;
30  out << &refset;
31  EXPECT_EQ(out.str(), "\n[3 5 ]\n");
32 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
TEST_F ( LoggingTests  ,
DumpHeaderVector   
)

Definition at line 34 of file LoggingTests.cpp.

References EXPECT_EQ.

34  {
35  vector<HPACKHeader> headers;
36  headers.push_back(HPACKHeader(":path", "index.html"));
37  headers.push_back(HPACKHeader("content-type", "gzip"));
38  stringstream out;
39  out << headers;
40  EXPECT_EQ(out.str(), ":path: index.html\ncontent-type: gzip\n\n");
41 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
TEST_F ( LoggingTests  ,
PrintDelta   
)

Definition at line 43 of file LoggingTests.cpp.

References EXPECT_EQ, and proxygen::printDelta().

43  {
44  vector<HPACKHeader> v1;
45  v1.push_back(HPACKHeader(":path", "/"));
46  v1.push_back(HPACKHeader(":host", "www.facebook.com"));
47  vector<HPACKHeader> v2;
48 
49  // empty v1 or v2
50  EXPECT_EQ(printDelta(v1, v2), "\n + :path: /\n + :host: www.facebook.com\n");
51  EXPECT_EQ(printDelta(v2, v1), "\n - :path: /\n - :host: www.facebook.com\n");
52 
53  // skip first header from v1
54  v2.push_back(HPACKHeader(":path", "/"));
55  EXPECT_EQ(printDelta(v1, v2), "\n + :host: www.facebook.com\n");
56 
57  v2.push_back(HPACKHeader(":path", "/"));
58  EXPECT_EQ(printDelta(v2, v1),
59  "\n - :host: www.facebook.com\n + :path: / (duplicate)\n");
60 
61  v2.pop_back();
62  v1.clear();
63  v1.push_back(HPACKHeader(":a", "b"));
64  v1.push_back(HPACKHeader(":a", "b"));
65  v1.push_back(HPACKHeader(":path", "/"));
66  EXPECT_EQ(printDelta(v1, v2), "\n + :a: b\n duplicate :a: b\n");
67 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
string printDelta(const vector< HPACKHeader > &v1, const vector< HPACKHeader > &v2)
Definition: Logging.cpp:38
TEST_F ( LoggingTests  ,
DumpBin   
)

Definition at line 69 of file LoggingTests.cpp.

References proxygen::HPACKEncodeBuffer::encodeLiteral(), EXPECT_EQ, and proxygen::HPACKEncodeBuffer::toBin().

69  {
70  // test with an HPACKEncodeBuffer
71  HPACKEncodeBuffer buf(128);
72  buf.encodeLiteral("test");
73  EXPECT_EQ(buf.toBin(),
74  "00000100 01110100 t 01100101 e 01110011 s 01110100 t \n");
75 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922