MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/core/grappler/utils_test.cc:384–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384TEST(CheckAttrExists, All) {
385 NodeDef node;
386 node.set_name("node");
387 (*node.mutable_attr())["apple"].set_i(7);
388 (*node.mutable_attr())["pear"].set_b(true);
389
390 TF_EXPECT_OK(CheckAttrExists(node, "apple"));
391 TF_EXPECT_OK(CheckAttrExists(node, "pear"));
392
393 TF_EXPECT_OK(CheckAttrsExist(node, {}));
394 TF_EXPECT_OK(CheckAttrsExist(node, {"apple"}));
395 TF_EXPECT_OK(CheckAttrsExist(node, {"pear"}));
396 TF_EXPECT_OK(CheckAttrsExist(node, {"apple", "pear"}));
397 TF_EXPECT_OK(CheckAttrsExist(node, {"pear", "apple"}));
398
399 Status status = CheckAttrExists(node, "banana");
400 EXPECT_FALSE(status.ok());
401 EXPECT_EQ(status.ToString(),
402 "Invalid argument: Node 'node' lacks 'banana' attr: name: \"node\" "
403 "attr { key: \"apple\" value { i: 7 } } attr { key: \"pear\" value "
404 "{ b: true } }");
405 EXPECT_FALSE(CheckAttrsExist(node, {""}).ok());
406 EXPECT_FALSE(CheckAttrsExist(node, {"pear", "cherry"}).ok());
407 EXPECT_FALSE(CheckAttrsExist(node, {"banana", "apple"}).ok());
408}
409
410TEST_F(UtilsTest, DeleteNodes) {
411 // TODO(rmlarsen): write forgotten test.

Callers

nothing calls this directly

Calls 10

CheckAttrExistsFunction · 0.85
CheckAttrsExistFunction · 0.85
set_opMethod · 0.80
minFunction · 0.50
maxFunction · 0.50
set_nameMethod · 0.45
okMethod · 0.45
ToStringMethod · 0.45
set_deviceMethod · 0.45

Tested by

no test coverage detected