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

Commit 21f3655e authored by Haibo Huang's avatar Haibo Huang
Browse files

Be compatible with new google test

1. Remove the use of ::std::tr1
2. arg in matcher become const.

Test: compile
Change-Id: Iba7cdc568b55f436b695e3fb39c1b0975d983ae8
parent d760eb86
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;
}