fbzmq/async/tests/ZmqEventLoopTest.cpp
TEST(ZmqEventLoopTest, CopyCapture) {
  ZmqEventLoop evl;
  auto const& now = std::chrono::steady_clock::now();

  auto callback = std::function<void()>([&]() noexcept {
    SUCCEED();
    evl.stop();
  });
  evl.scheduleTimeout(std::chrono::seconds(0), callback);

  LOG(INFO) << "Starting loop...";
  evl.run();
  EXPECT_GE(
      evl.getTimestamp().time_since_epoch().count(),
      now.time_since_epoch().count());

  LOG(INFO) << "Stopping loop...";
  SUCCEED();
}
/**
 * This test is to ensure that callbacks can be passed as copy to be executed
 * asynchronously. (Tests compilation is possible).
 */
This test is to ensure that callbacks can be passed as copy to be executed
asynchronously. (Tests compilation is possible).
This test is to ensure that callbacks can be passed as copy to be executed asynchronously . ( Tests compilation is possible ) .
TEST(ZmqEventLoopTest, CopyCapture) {
  ZmqEventLoop evl;
  auto const& now = std::chrono::steady_clock::now();
  auto callback = std::function<void()>([&]() noexcept {
    SUCCEED();
    evl.stop();
  });
  evl.scheduleTimeout(std::chrono::seconds(0), callback);
  LOG(INFO) << "Starting loop...";
  evl.run();
  EXPECT_GE(
      evl.getTimestamp().time_since_epoch().count(),
      now.time_since_epoch().count());
  LOG(INFO) << "Stopping loop...";
  SUCCEED();
}
TEST ( ZmqEventLoopTest , CopyCapture ) { ZmqEventLoop evl ; auto const & now = std :: chrono :: steady_clock :: now ( ) ; auto callback = std :: function < void ( ) > ( [ & ] ( ) noexcept { SUCCEED ( ) ; evl . stop ( ) ; } ) ; evl . scheduleTimeout ( std :: chrono :: seconds ( 0 ) , callback ) ; LOG ( INFO ) << " " ; evl . run ( ) ; EXPECT_GE ( evl . getTimestamp ( ) . time_since_epoch ( ) . count ( ) , now . time_since_epoch ( ) . count ( ) ) ; LOG ( INFO ) << " " ; SUCCEED ( ) ; }
This test is to ensure that callbacks can be passed as copy to be executed
 asynchronously.
This test is to ensure that callbacks can be passed as copy to be executed asynchronously .