title: Google Mock matching an array
body: <p>I know this has been asked multiple times but none of the answers work for me.
  This is the mocked func I want to test:</p>
  
  <pre><code>  MOCK_METHOD2(sendInternal, void(uint8_t data[], uint8_t size));
  </code></pre>
  
  <p>The test goes like this</p>
  
  <pre><code>    uint8_t expectedMessageData[3] = { 0x08, 0xda, 0xff };
  
  
      EXPECT_CALL(*serverFake, sendInternal(testing::_,3))
              .With(testing::Args&lt;0, 1&gt;(ElementsAre(0x08, 0xda, 0xff)))
              .Times(1);
  </code></pre>
  
  <p>But this results in</p>
  
  <blockquote>
    <p>Expected args: are a tuple whose fields (#0, #1) has 2 elements where
    element #0 is equal to '\b' (8),
    element #1 is equal to '\xDA' (218)
               Actual: don't match, whose fields (#0, #1) are (0x7fcfd9500590, '\x11' (3)), which has 3 elements</p>
  </blockquote>
  
  <p>To me it seems like Gmock would compare the params and not the array's elements.</p>
  
  <p>I've even built a custom matcher:</p>
  
  <pre><code>MATCHER_P2(HasBytes, bytes, size, "") {
      uint8_t * dataToCheck = arg;
      bool isMatch = (memcmp(dataToCheck, bytes, size) == 0);
      return isMatch;
  }
  </code></pre>
  
  <p>I can see (while debugging) that isMatch == true but the test still fails.</p>
  
  <p>Please help!</p>