virtual std::uint64_t encodeHdrAndMsg()
    {
        MessageHeader hdr;
        Msg msg;

        hdr.wrap(m_buffer, 0, 0, sizeof(m_buffer))
            .blockLength(Msg::sbeBlockLength())
            .templateId(Msg::sbeTemplateId())
            .schemaId(Msg::sbeSchemaId())
            .version(Msg::sbeSchemaVersion());

        msg.wrapForEncode(m_buffer, hdr.encodedLength(), sizeof(m_buffer));

        msg.structure()
            .enumOne(EnumOne::Value10)
            .zeroth(42)
            .setOne().clear().bit0(false).bit16(true).bit26(false);

        msg.structure()
            .inner()
                .first(101)
                .second(202);

        return hdr.encodedLength() + msg.encodedLength();
    }
TEST_F(CompositeElementsTest, shouldEncodeAndDecodeMsgCorrectly)
{
    std::uint64_t sz = encodeHdrAndMsg();

    ASSERT_EQ(sz, MessageHeader::encodedLength() + Msg::sbeBlockLength());

    MessageHeader hdr;
    Msg msg;

    hdr.wrap(m_buffer, 0, Msg::sbeSchemaVersion(), sizeof(m_buffer));

    EXPECT_EQ(hdr.blockLength(), Msg::sbeBlockLength());
    EXPECT_EQ(hdr.templateId(), Msg::sbeTemplateId());
    EXPECT_EQ(hdr.schemaId(), Msg::sbeSchemaId());
    EXPECT_EQ(hdr.version(), Msg::sbeSchemaVersion());

    msg.wrapForDecode(m_buffer, MessageHeader::encodedLength(), hdr.blockLength(), hdr.version(), sizeof(m_buffer));

    EXPECT_EQ(msg.structure().enumOne(), EnumOne::Value::Value10);
    EXPECT_EQ(msg.structure().zeroth(), 42u);
    EXPECT_EQ(msg.structure().setOne().bit0(), false);
    EXPECT_EQ(msg.structure().setOne().bit16(), true);
    EXPECT_EQ(msg.structure().setOne().bit26(), false);
    EXPECT_EQ(msg.structure().inner().first(), 101l);
    EXPECT_EQ(msg.structure().inner().second(), 202l);

    EXPECT_EQ(msg.encodedLength(), sz - MessageHeader::encodedLength());
}