@@ -404,7 +404,7 @@ mod sequence {
404
404
const ALGORITHM_IDENTIFIER_DER : & [ u8 ] =
405
405
& hex ! ( "30 13 06 07 2a 86 48 ce 3d 02 01 06 08 2a 86 48 ce 3d 03 01 07" ) ;
406
406
407
- #[ derive( Sequence ) ]
407
+ #[ derive( Sequence , Default , Eq , PartialEq , Debug ) ]
408
408
#[ asn1( tag_mode = "IMPLICIT" ) ]
409
409
pub struct TypeCheckExpandedSequenceFieldAttributeCombinations < ' a > {
410
410
pub simple : bool ,
@@ -423,7 +423,34 @@ mod sequence {
423
423
#[ asn1( context_specific = "3" , default = "default_false_example" ) ]
424
424
pub context_specific_default : bool ,
425
425
#[ asn1( type = "BIT STRING" , context_specific = "4" , optional = "true" ) ]
426
- pub typed_context_specific_optional : Option < & ' a [ u8 ] > ,
426
+ pub typed_context_specific_optional_bits : Option < & ' a [ u8 ] > ,
427
+ #[ asn1( type = "OCTET STRING" , context_specific = "5" , optional = "true" ) ]
428
+ pub typed_context_specific_optional_implicit : Option < & ' a [ u8 ] > ,
429
+ #[ asn1(
430
+ type = "OCTET STRING" ,
431
+ context_specific = "6" ,
432
+ optional = "true" ,
433
+ tag_mode = "EXPLICIT"
434
+ ) ]
435
+ pub typed_context_specific_optional_explicit : Option < & ' a [ u8 ] > ,
436
+ }
437
+
438
+ #[ test]
439
+ fn type_combinations_instance ( ) {
440
+ let obj = TypeCheckExpandedSequenceFieldAttributeCombinations {
441
+ context_specific_optional : Some ( true ) ,
442
+ typed_context_specific : & [ 0 , 1 ] ,
443
+ typed_context_specific_optional_bits : Some ( & [ 2 , 3 ] ) ,
444
+ typed_context_specific_optional_implicit : Some ( & [ 4 , 5 , 6 ] ) ,
445
+ typed_context_specific_optional_explicit : Some ( & [ 7 , 8 ] ) ,
446
+
447
+ ..Default :: default ( )
448
+ } ;
449
+
450
+ let der_encoded = obj. to_der ( ) . unwrap ( ) ;
451
+ let obj_decoded =
452
+ TypeCheckExpandedSequenceFieldAttributeCombinations :: from_der ( & der_encoded) . unwrap ( ) ;
453
+ assert_eq ! ( obj, obj_decoded) ;
427
454
}
428
455
429
456
#[ derive( Sequence ) ]
0 commit comments