@@ -112,7 +112,7 @@ mod choice {
112112 /// `Choice` with `IMPLICIT` tagging.
113113 mod implicit {
114114 use der:: {
115- Choice , Decode , Encode , SliceWriter ,
115+ Choice , Decode , Encode , Sequence , SliceWriter ,
116116 asn1:: { BitStringRef , GeneralizedTime } ,
117117 } ;
118118 use hex_literal:: hex;
@@ -179,6 +179,13 @@ mod choice {
179179 cs_time. encode ( & mut encoder) . unwrap ( ) ;
180180 assert_eq ! ( TIME_DER , encoder. finish( ) . unwrap( ) ) ;
181181 }
182+
183+ /// Test case for `CHOICE` inside `[0]` `EXPLICIT` tag in `SEQUENCE`.
184+ #[ derive( Sequence , Debug , Eq , PartialEq ) ]
185+ pub struct ExplicitChoiceInsideSequence < ' a > {
186+ #[ asn1( tag_mode = "EXPLICIT" , context_specific = "0" ) ]
187+ choice_field : ImplicitChoice < ' a > ,
188+ }
182189 }
183190}
184191
@@ -743,6 +750,21 @@ mod decode_value {
743750 }
744751}
745752
753+ /// Custom derive test cases for the `DecodeValue` + `EncodeValue` macro combo.
754+ mod decode_encode_value {
755+ use der:: { DecodeValue , EncodeValue , IsConstructed } ;
756+
757+ /// Example of a structure, that does not have a tag and is not a sequence
758+ /// but can be encoded as `[0] IMPLICIT`
759+ #[ derive( DecodeValue , EncodeValue , Default , Eq , PartialEq , Debug ) ]
760+ struct DecodeEncodeCheck {
761+ field : bool ,
762+ }
763+ impl IsConstructed for DecodeEncodeCheck {
764+ const CONSTRUCTED : bool = true ;
765+ }
766+ }
767+
746768/// Custom derive test cases for the `BitString` macro.
747769#[ cfg( feature = "std" ) ]
748770mod bitstring {
0 commit comments