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

Function TEST

test/concurrent/test_transient_topic.cpp:10–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8using ::babylon::ConcurrentTransientTopic;
9
10TEST(concurrent_transient_topic, movable) {
11 ConcurrentTransientTopic<::std::string> topic;
12 topic.publish("1");
13 topic.publish("2");
14 ConcurrentTransientTopic<::std::string> moved_topic(::std::move(topic));
15 ConcurrentTransientTopic<::std::string> move_assigned_topic;
16 move_assigned_topic = ::std::move(moved_topic);
17 move_assigned_topic.publish("3");
18 move_assigned_topic.publish("4");
19 move_assigned_topic.close();
20
21 auto consumer = move_assigned_topic.subscribe();
22 ASSERT_EQ("1", *consumer.consume());
23 ASSERT_EQ("2", *consumer.consume());
24 ASSERT_EQ("3", *consumer.consume());
25 ASSERT_EQ("4", *consumer.consume());
26 ASSERT_EQ(nullptr, consumer.consume());
27}
28
29TEST(concurrent_transient_topic, publish_consume_fifo) {
30 ConcurrentTransientTopic<::std::string> topic;

Callers

nothing calls this directly

Calls 15

get_futureMethod · 0.80
set_valueMethod · 0.80
wait_forMethod · 0.80
emplace_backMethod · 0.80
loadMethod · 0.80
publishMethod · 0.45
closeMethod · 0.45
subscribeMethod · 0.45
consumeMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected