| 51 | const int g_bar = 20; |
| 52 | |
| 53 | TEST_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 | } |
nothing calls this directly
no test coverage detected