Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4d63fe4 authored by Haibo Huang's avatar Haibo Huang Committed by Gerrit Code Review
Browse files

Merge "Be compatible with new google test"

parents d760eb86 21f3655e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ class WriteOnFdAction : public ActionInterface<WriteOnFdFunction> {
    explicit WriteOnFdAction(const std::string& output) : output_(output) {
    }
    virtual Result Perform(const ArgumentTuple& args) {
        int fd = ::std::tr1::get<0>(args);
        int fd = ::testing::get<0>(args);
        android::base::WriteStringToFd(output_, fd);
    }

+7 −5
Original line number Diff line number Diff line
@@ -51,22 +51,24 @@ MATCHER_P2(IoVecMatcher, ptr, size, "") {
//             method(IoVecMatcher(IoVecArray{{ptr1, size1}, {ptr2, size2}})));
using IoVecArray = std::vector<iovec>;
MATCHER_P(IoVecMatcher, iovec_array, "") {
  auto local_arg = arg;
  for (const iovec& item : iovec_array) {
    if (arg->iov_base != item.iov_base || arg->iov_len != item.iov_len)
    if (local_arg->iov_base != item.iov_base || local_arg->iov_len != item.iov_len)
      return false;
    arg++;
    local_arg++;
  }
  return true;
}

using IoVecData = std::vector<std::string>;
MATCHER_P(IoVecDataMatcher, iovec_data, "") {
  auto local_arg = arg;
  for (const std::string& item : iovec_data) {
    std::string data{reinterpret_cast<const char*>(arg->iov_base),
                     arg->iov_len};
    std::string data{reinterpret_cast<const char*>(local_arg->iov_base),
                     local_arg->iov_len};
    if (data != item)
      return false;
    arg++;
    local_arg++;
  }
  return true;
}