void wrapTestWithParty()

in fbpcf/mpc/EmpTestUtil.h [57:80]


void wrapTestWithParty(TestCase testCase) {
  auto queueA = std::make_shared<folly::Synchronized<std::queue<char>>>();
  auto queueB = std::make_shared<folly::Synchronized<std::queue<char>>>();

  auto lambda = [&queueA, &queueB, &testCase](Party party) {
    auto io = std::make_unique<QueueIO>(
        party == Party::Alice ? QueueIO{queueA, queueB}
                              : QueueIO{queueB, queueA});
    emp::setup_semi_honest(io.get(), static_cast<int>(party));

    try {
      testCase(party);
    } catch (const std::exception& e) {
      std::cout << "Exception occured. " << e.what() << endl;
      exit(EXIT_FAILURE);
    }
  };

  auto futureAlice = std::async(lambda, Party::Alice);
  auto futureBob = std::async(lambda, Party::Bob);

  futureAlice.wait();
  futureBob.wait();
}