We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test:
#include "ut.hpp" #include "ut_proto.hpp" struct o_params : med::sequence< O<C<0x01>, FLD_UC>, O<C<0x02>, FLD_U8>, O<C<0x03>, FLD_U16>> { }; struct m_params : med::sequence< M<FLD_UC>, M<FLD_U8>, M<FLD_U16>> { }; struct params : med::sequence< M<FLD_U8>, O<C<0x04>, o_params>, O<C<0x05>, m_params>> { }; TEST(sequence, optional) { params p1; p1.ref<FLD_U8>().set(0); p1.ref<o_params>().ref<FLD_U8>().set(1); p1.ref<m_params>().ref<FLD_UC>().set(2); p1.ref<m_params>().ref<FLD_U8>().set(3); p1.ref<m_params>().ref<FLD_U16>().set(4); uint8_t e_buffer[64]; med::encoder_context e_ctx{e_buffer}; encode(med::octet_encoder{e_ctx}, p1); uint8_t d_buffer[64]; med::allocator d_alloc{d_buffer}; med::decoder_context<med::allocator> d_ctx{e_ctx.buffer().get_start(), e_ctx.buffer().get_offset(), &d_alloc}; params p2; med::decode(med::octet_decoder{d_ctx}, p2); EXPECT_NE(p2.get<m_params>(), nullptr); }
Adding length to o_params fixes the problem (O<C<0x04>, L, o_params>) .
O<C<0x04>, L, o_params>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Test:
Adding length to o_params fixes the problem (
O<C<0x04>, L, o_params>
) .The text was updated successfully, but these errors were encountered: