title: How to check the structs(fields) stored in the vector using gtest constructs?
body: <p>I want to check the validity of the structs stored in the container using <em>gtest</em>. One way of doing it is retrieving the struct and comparing with the expected value. Is there a better way other than this using <em>gtest</em> constructs.</p>
  
  <pre><code>auto receivedflexmessages = m_pugwintegration-&gt;getFlexMessages();
  EXPECT_EQ(m_expectedflexmessages.size(), receivedflexmessages.size()) &lt;&lt; "Mismatch in the received messages";
  
  for (auto i = 0; i &lt; receivedflexmessages.size(); i++)
  {
      EXPECT_EQ(m_expectedflexmessages[i].m_extId, receivedflexmessages[i].m_extId) &lt;&lt; i &lt;&lt; "Mismatch in extId";
      EXPECT_EQ(m_expectedflexmessages[i].m_handle, receivedflexmessages[i].m_handle) &lt;&lt; i &lt;&lt; "Mismatch in handle";
      EXPECT_EQ(m_expectedflexmessages[i].m_payloadLength, receivedflexmessages[i].m_payloadLength) &lt;&lt; i &lt;&lt; "Mismatch in payloadlength";
  
      if (m_expectedflexmessages[i].m_payloadLength == receivedflexmessages[i].m_payloadLength)
      {
          for (auto j = 0; j &lt; m_expectedflexmessages[i].m_payloadLength; ++j)
          {
              EXPECT_EQ(m_expectedflexmessages[i].m_pPayload[j], receivedflexmessages[i].m_pPayload[j]) &lt;&lt; "Payload expected and received differ at index " &lt;&lt; j;
          }
      }
  </code></pre>