title: How to solve gmock EXPECT_CALL failure, when variable passed to function doesn't matter
body: <p>I had <code>EXPECT_CALL</code> passing on my tests, until I added a header to wrap the <code>unsigned char *</code> I was testing for. I understand that the test is falling, since it isn't the same <code>unsigned char *</code> as expected. I'm just not sure how to redesign my tests, so the <code>unsigned char *</code> assigned to causes the test to pass.</p>
  
  <p>My test(With initialization of variables left out):</p>
  
  <pre><code>EXPECT_CALL(networkConnectionMock, Transmit(packetData, dataSize));
  
  packetManager.Update(0.01f);
  packetManager.Send(packetData, dataSize);
  </code></pre>
  
  <p>The function under test:</p>
  
  <pre><code>void PacketManager::Send(unsigned char *packetData, int packetSize)
  {
      if(this-&gt;secondSinceLastUpdate &lt;= 1.0f)
          packetsSent++;
      else
      {
          packetsSent = 0;
          this-&gt;secondSinceLastUpdate = 0.0f;
      }
  
      std::stringstream convert;
      convert &lt;&lt; htonl((uint32_t)packetSize);
      Header *header = new Header;
      header-&gt;name = "PKT_" + convert.str();
      header-&gt;packetSize = packetSize;
      header-&gt;packetData = packetData;
      unsigned char * pktHeader = new unsigned char[sizeof(Header)];
      pktHeader = (unsigned char*)header;
      PKT_Header = pktHeader; // tried assigning to public variable, 
                             // but would be assigned to after EXPECT_CALL is setup.
      int totalPacketSize = packetSize; // rewrite to loop through que
      if(header-&gt;packetSize &lt;= 800 &amp;&amp; totalPacketSize &lt;= 1024 &amp;&amp; packetsSent &lt;= 30)
          networkConnection-&gt;Transmit(pktHeader, packetSize);
  }
  </code></pre>
  
  <p>gmock output:</p>
  
  <pre><code>[==========] Running 1 test from 1 test case.
  [----------] Global test environment set-up.
  [----------] 1 test from PacketManager
  [ RUN      ] PacketManager.SendsPacketsUnder1024
  unknown file: Failure
  
  Unexpected mock function call - returning directly.
      Function call: Transmit(0x2096c10, 100)
  Google Mock tried the following 1 expectation, but it didn't match:
  
  /home/zerophase/ClionProjects/PacketManager/tests/basic_tests/basic_check.cpp:20: EXPECT_CALL(networkConnectionMock, Transmit(packetData, dataSize))...
    Expected arg #0: is equal to 0x2096560
             Actual: 0x2096c10
           Expected: to be called once
             Actual: never called - unsatisfied and active
  /home/zerophase/ClionProjects/PacketManager/tests/basic_tests/basic_check.cpp:20: Failure
  Actual function call count doesn't match EXPECT_CALL(networkConnectionMock, Transmit(packetData, dataSize))...
           Expected: to be called once
             Actual: never called - unsatisfied and active
  [  FAILED  ] PacketManager.SendsPacketsUnder1024 (0 ms)
  [----------] 1 test from PacketManager (0 ms total)
  
  [----------] Global test environment tear-down
  [==========] 1 test from 1 test case ran. (0 ms total)
  [  PASSED  ] 0 tests.
  [  FAILED  ] 1 test, listed below:
  [  FAILED  ] PacketManager.SendsPacketsUnder1024
  </code></pre>
  
  <p>Is EXPECT_CALL still what I want to use to test for <code>Transmit</code> being called?</p>