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

Method SetUp

test/anyflow/test_channel.cpp:85–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83
84struct ChannelTest : public ::testing::Test {
85 virtual void SetUp() override {
86 executor.initialize(4, 128);
87 builder.set_executor(executor);
88 {
89 auto& vertex = builder.add_vertex([] {
90 return ::std::unique_ptr<ChannelOutputProcessor>(
91 new ChannelOutputProcessor);
92 });
93 vertex.named_emit("x").to("A");
94 }
95 {
96 auto& vertex = builder.add_vertex([] {
97 return ::std::unique_ptr<ChannelInputProcessor>(
98 new ChannelInputProcessor);
99 });
100 vertex.named_depend("a").to("A");
101 vertex.named_emit("done").to("B");
102 }
103 {
104 auto& vertex = builder.add_vertex([] {
105 return ::std::unique_ptr<ChannelOutputProcessor>(
106 new ChannelOutputProcessor);
107 });
108 vertex.named_emit("x").to("MA");
109 }
110 {
111 auto& vertex = builder.add_vertex([] {
112 return ::std::unique_ptr<MutableChannelInputProcessor>(
113 new MutableChannelInputProcessor);
114 });
115 vertex.named_depend("a").to("MA");
116 vertex.named_emit("done").to("C");
117 }
118 ASSERT_EQ(0, builder.finish());
119 graph = builder.build();
120 ASSERT_TRUE(graph);
121
122 a = graph->find_data("A");
123 b = graph->find_data("B");
124 c = graph->find_data("C");
125
126 ChannelOutputProcessor::enter_promise =
127 ::std::promise<OutputChannel<::std::string>>();
128 ChannelOutputProcessor::enter_future =
129 ChannelOutputProcessor::enter_promise.get_future();
130
131 ChannelOutputProcessor::leave_promise = ::std::promise<void>();
132 ChannelOutputProcessor::leave_future =
133 ChannelOutputProcessor::leave_promise.get_future();
134
135 ChannelInputProcessor::enter_promise =
136 ::std::promise<ChannelConsumer<::std::string>>();
137 ChannelInputProcessor::enter_future =
138 ChannelInputProcessor::enter_promise.get_future();
139
140 ChannelInputProcessor::leave_promise = ::std::promise<void>();
141 ChannelInputProcessor::leave_future =
142 ChannelInputProcessor::leave_promise.get_future();

Callers

nothing calls this directly

Calls 7

find_dataMethod · 0.80
get_futureMethod · 0.80
initializeMethod · 0.45
set_executorMethod · 0.45
named_emitMethod · 0.45
finishMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected