MCPcopy Create free account
hub / github.com/apache/brpc / TEST_F

Function TEST_F

test/brpc_extension_unittest.cpp:53–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51const int g_bar = 20;
52
53TEST_F(ExtensionTest, basic) {
54 ConstIntExtension()->Register("foo", NULL);
55 ConstIntExtension()->Register("foo", &g_foo);
56 ConstIntExtension()->Register("bar", &g_bar);
57
58 int* val1 = new int(0xbeef);
59 int* val2 = new int(0xdead);
60 ASSERT_EQ(0, IntExtension()->Register("hello", val1));
61 ASSERT_EQ(-1, IntExtension()->Register("hello", val1));
62 IntExtension()->Register("there", val2);
63 ASSERT_EQ(val1, IntExtension()->Find("hello"));
64 ASSERT_EQ(val2, IntExtension()->Find("there"));
65 std::ostringstream os;
66 IntExtension()->List(os, ':');
67 ASSERT_EQ("hello:there", os.str());
68
69 os.str("");
70 ConstIntExtension()->List(os, ':');
71 ASSERT_EQ("foo:bar", os.str());
72}

Callers

nothing calls this directly

Calls 5

ConstIntExtensionFunction · 0.85
IntExtensionFunction · 0.85
RegisterMethod · 0.45
FindMethod · 0.45
ListMethod · 0.45

Tested by

no test coverage detected