| 25 | namespace tensorflow { |
| 26 | |
| 27 | TEST(MapUtil, Find) { |
| 28 | typedef std::map<string, string> Map; |
| 29 | Map m; |
| 30 | |
| 31 | // Check that I can use a type that's implicitly convertible to the |
| 32 | // key or value type, such as const char* -> string. |
| 33 | EXPECT_EQ("", gtl::FindWithDefault(m, "foo", "")); |
| 34 | m["foo"] = "bar"; |
| 35 | EXPECT_EQ("bar", gtl::FindWithDefault(m, "foo", "")); |
| 36 | EXPECT_EQ("bar", *gtl::FindOrNull(m, "foo")); |
| 37 | EXPECT_TRUE(m.count("foo") > 0); |
| 38 | EXPECT_EQ(m["foo"], "bar"); |
| 39 | } |
| 40 | |
| 41 | TEST(MapUtil, LookupOrInsert) { |
| 42 | typedef std::map<string, string> Map; |
nothing calls this directly
no test coverage detected