| 8 | using ::babylon::ConcurrentTransientTopic; |
| 9 | |
| 10 | TEST(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 | |
| 29 | TEST(concurrent_transient_topic, publish_consume_fifo) { |
| 30 | ConcurrentTransientTopic<::std::string> topic; |
nothing calls this directly
no test coverage detected