@@ -22,7 +22,7 @@ TEST_CASE("simple field and sequence optional encoder_v2/decoder_v2","[field_seq
2222 // 1 : Set Template Id.
2323 // 1 : Set Field field_1_1
2424 // 0 : XXX
25- REQUIRE (test_case.encoding (test_1.cref ()," \xE0\x81\x82\x81 " ,true ));
25+ REQUIRE (test_case.encoding (test_1.cref ()," \xE0\x81\x82\x80 " ,true ));
2626 REQUIRE (test_case.decoding (" \xE0\x81\x82\x80 " ,test_1.cref (),true ));
2727 }
2828
@@ -246,3 +246,38 @@ TEST_CASE("simple optional field with default value encoder_v2/decoder_v2","[opt
246246 REQUIRE (test_case.decoding (" \xD0\x86\x82 " ,test_6.cref (),true ));
247247 }
248248}
249+
250+ TEST_CASE (" sequence optional with constant length encoder_v2/decoder_v2" ," [optional_sequence_with_constant_length_encoder_v2/decoder_v2]" )
251+ {
252+ fast_test_coding_case_v2<simple12::templates_description> test_case;
253+
254+ SECTION (" encode fields without sequence" )
255+ {
256+ simple12::Test_7 test_7;
257+ simple12::Test_7_mref test_7_mref = test_7.mref ();
258+ test_7_mref.set_field_7_1 ().as (1 );
259+ REQUIRE (test_case.encoding (test_7.cref ()," \xE0\x87\x82 " ,true ));
260+ REQUIRE (test_case.decoding (" \xE0\x87\x82 " ,test_7.cref (),true ));
261+ }
262+
263+ SECTION (" encode fields with sequence" )
264+ {
265+ simple12::Test_7 test_7;
266+ simple12::Test_7_mref test_7_mref = test_7.mref ();
267+ test_7_mref.set_field_7_1 ().as (1 );
268+
269+ {
270+ auto sequence_7_mref = test_7_mref.set_sequence_7 ();
271+ sequence_7_mref.resize (1 );
272+
273+ {
274+ auto element_sequence = sequence_7_mref.front ();
275+ element_sequence.set_field_7_4 ().as (1 );
276+ element_sequence.set_field_7_5 ().as (1 );
277+ }
278+ }
279+
280+ REQUIRE (test_case.encoding (test_7.cref ()," \xF0\x87\x82\xa0\x82\x82 " ,true ));
281+ REQUIRE (test_case.decoding (" \xF0\x87\x82\xa0\x82\x82 " ,test_7.cref (),true ));
282+ }
283+ }
0 commit comments