MCPcopy Create free account
hub / github.com/baidu/babylon / SetUp

Method SetUp

test/anyflow/test_dependency.cpp:51–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50struct DependencyTest : public ::testing::Test {
51 virtual void SetUp() override {
52 {
53 auto& vertex = builder.add_vertex([] {
54 return ::std::unique_ptr<ConstProcessor>(new ConstProcessor);
55 });
56 vertex.named_depend("a").to("A").on("C1");
57 vertex.named_emit("x").to("X");
58 }
59 {
60 auto& vertex = builder.add_vertex([] {
61 return ::std::unique_ptr<ConstProcessor>(new ConstProcessor);
62 });
63 vertex.named_depend("a").to("A").on("C2");
64 vertex.named_emit("x").to("Y");
65 }
66 {
67 auto& vertex = builder.add_vertex([] {
68 return ::std::unique_ptr<MutableProcessor>(new MutableProcessor);
69 });
70 vertex.named_depend("a").to("A").on("C3");
71 vertex.named_emit("x").to("Z");
72 }
73 {
74 auto& vertex = builder.add_vertex([] {
75 return ::std::unique_ptr<VariableProcessor>(new VariableProcessor);
76 });
77 for (size_t index = 0; index < v.size(); index++) {
78 vertex.anonymous_depend().to(v[index]).on("C4");
79 }
80 for (size_t index = 0; index < rv.size(); index++) {
81 vertex.anonymous_emit().to(rv[index]);
82 }
83 }
84 builder.finish();
85 graph = builder.build();
86 a = graph->find_data("A");
87 x = graph->find_data("X");
88 y = graph->find_data("Y");
89 z = graph->find_data("Z");
90 for (size_t index = 0; index < v.size(); index++) {
91 gv.emplace_back(graph->find_data(v[index]));
92 }
93 for (size_t index = 0; index < rv.size(); index++) {
94 grv.emplace_back(graph->find_data(rv[index]));
95 }
96 c1 = graph->find_data("C1");
97 c2 = graph->find_data("C2");
98 c3 = graph->find_data("C3");
99 c4 = graph->find_data("C4");
100 }
101
102 GraphBuilder builder;
103 ::std::unique_ptr<Graph> graph;

Callers

nothing calls this directly

Calls 7

find_dataMethod · 0.80
emplace_backMethod · 0.80
named_emitMethod · 0.45
sizeMethod · 0.45
anonymous_emitMethod · 0.45
finishMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected