diff --git a/mediapipe/framework/api2/builder_test.cc b/mediapipe/framework/api2/builder_test.cc index 361f740c4..d8522b3c8 100644 --- a/mediapipe/framework/api2/builder_test.cc +++ b/mediapipe/framework/api2/builder_test.cc @@ -55,16 +55,16 @@ TEST(BuilderTest, BuildGraph) { TEST(BuilderTest, CopyableSource) { Graph graph; - Source a = graph[Input("A")]; + Source a = graph.In("A").Cast(); a.SetName("a"); - Source b = graph[Input("B")]; + Source b = graph.In("B").Cast(); b.SetName("b"); - SideSource side_a = graph[SideInput("SIDE_A")]; + SideSource side_a = graph.SideIn("SIDE_A").Cast(); side_a.SetName("side_a"); - SideSource side_b = graph[SideInput("SIDE_B")]; + SideSource side_b = graph.SideIn("SIDE_B").Cast(); side_b.SetName("side_b"); - Destination out = graph[Output("OUT")]; - SideDestination side_out = graph[SideOutput("SIDE_OUT")]; + Destination out = graph.Out("OUT").Cast(); + SideDestination side_out = graph.SideOut("SIDE_OUT").Cast(); Source input = a; input = b; @@ -89,28 +89,28 @@ TEST(BuilderTest, CopyableSource) { TEST(BuilderTest, BuildGraphWithFunctions) { Graph graph; - Source base = graph[Input("IN")]; + Source base = graph.In("IN").Cast(); base.SetName("base"); - SideSource side = graph[SideInput("SIDE")]; + SideSource side = graph.SideIn("SIDE").Cast(); side.SetName("side"); auto foo_fn = [](Source base, SideSource side, Graph& graph) { auto& foo = graph.AddNode("Foo"); - base >> foo[Input("BASE")]; - side >> foo[SideInput("SIDE")]; - return foo[Output("OUT")]; + base >> foo.In("BASE"); + side >> foo.SideIn("SIDE"); + return foo.Out("OUT")[0].Cast(); }; Source foo_out = foo_fn(base, side, graph); auto bar_fn = [](Source in, Graph& graph) { auto& bar = graph.AddNode("Bar"); - in >> bar[Input("IN")]; - return bar[Output("OUT")]; + in >> bar.In("IN"); + return bar.Out("OUT")[0].Cast(); }; Source bar_out = bar_fn(foo_out, graph); bar_out.SetName("out"); - bar_out >> graph[Output("OUT")]; + bar_out >> graph.Out("OUT"); CalculatorGraphConfig expected = mediapipe::ParseTextProtoOrDie(R"pb( @@ -229,10 +229,10 @@ TEST(BuilderTest, TypedByPorts) { auto& foo = graph.AddNode(); auto& adder = graph.AddNode(); - graph[FooBar1::kIn].SetName("base") >> foo[Foo::kBase]; + graph.In(FooBar1::kIn).SetName("base") >> foo[Foo::kBase]; foo[Foo::kOut] >> adder[FloatAdder::kIn][0]; foo[Foo::kOut] >> adder[FloatAdder::kIn][1]; - adder[FloatAdder::kOut].SetName("out") >> graph[FooBar1::kOut]; + adder[FloatAdder::kOut].SetName("out") >> graph.Out(FooBar1::kOut); CalculatorGraphConfig expected = mediapipe::ParseTextProtoOrDie(R"pb( @@ -380,8 +380,8 @@ class AnyAndSameTypeCalculator : public NodeIntf { TEST(BuilderTest, AnyAndSameTypeHandledProperly) { Graph graph; - Source any_input = graph[Input{"GRAPH_ANY_INPUT"}]; - Source int_input = graph[Input{"GRAPH_INT_INPUT"}]; + Source any_input = graph.In("GRAPH_ANY_INPUT"); + Source int_input = graph.In("GRAPH_INT_INPUT").Cast(); auto& node = graph.AddNode("AnyAndSameTypeCalculator"); any_input >> node[AnyAndSameTypeCalculator::kAnyTypeInput];