@@ -528,7 +528,7 @@ mod sequence {
528528 pub owned_optional_implicit_bytes : Option < Vec < u8 > > ,
529529
530530 #[ asn1(
531- type = "OCTET STRING" ,
531+ type = "BIT STRING" ,
532532 context_specific = "6" ,
533533 optional = "true" ,
534534 tag_mode = "EXPLICIT"
@@ -568,6 +568,85 @@ mod sequence {
568568 assert_eq ! ( obj, obj_decoded) ;
569569 }
570570
571+ #[ derive( Sequence , Default , Eq , PartialEq , Debug ) ]
572+ #[ asn1( tag_mode = "IMPLICIT" ) ]
573+ pub struct TypeCheckArraysSequenceFieldAttributeCombinations {
574+ #[ asn1( type = "OCTET STRING" , deref = "true" ) ]
575+ pub array_bytes : [ u8 ; 2 ] ,
576+
577+ #[ asn1( type = "BIT STRING" , deref = "true" ) ]
578+ pub array_bits : [ u8 ; 2 ] ,
579+
580+ #[ asn1( type = "OCTET STRING" , context_specific = "0" , deref = "true" ) ]
581+ pub array_implicit_bytes : [ u8 ; 2 ] ,
582+
583+ #[ asn1( type = "BIT STRING" , context_specific = "1" , deref = "true" ) ]
584+ pub array_implicit_bits : [ u8 ; 2 ] ,
585+
586+ #[ asn1(
587+ type = "OCTET STRING" ,
588+ context_specific = "2" ,
589+ tag_mode = "EXPLICIT" ,
590+ deref = "true"
591+ ) ]
592+ pub array_explicit_bytes : [ u8 ; 2 ] ,
593+
594+ #[ asn1(
595+ type = "BIT STRING" ,
596+ context_specific = "3" ,
597+ tag_mode = "EXPLICIT" ,
598+ deref = "true"
599+ ) ]
600+ pub array_explicit_bits : [ u8 ; 2 ] ,
601+
602+ #[ asn1( type = "BIT STRING" , context_specific = "4" , optional = "true" ) ]
603+ pub array_optional_implicit_bits : Option < [ u8 ; 2 ] > ,
604+
605+ #[ asn1( type = "OCTET STRING" , context_specific = "5" , optional = "true" ) ]
606+ pub array_optional_implicit_bytes : Option < [ u8 ; 2 ] > ,
607+
608+ #[ asn1(
609+ type = "BIT STRING" ,
610+ context_specific = "6" ,
611+ optional = "true" ,
612+ tag_mode = "EXPLICIT"
613+ ) ]
614+ pub array_optional_explicit_bits : Option < [ u8 ; 2 ] > ,
615+
616+ #[ asn1(
617+ type = "OCTET STRING" ,
618+ context_specific = "7" ,
619+ optional = "true" ,
620+ tag_mode = "EXPLICIT"
621+ ) ]
622+ pub array_optional_explicit_bytes : Option < [ u8 ; 2 ] > ,
623+ }
624+
625+ #[ test]
626+ fn type_combinations_arrays_instance ( ) {
627+ let obj = TypeCheckArraysSequenceFieldAttributeCombinations {
628+ array_bytes : [ 0xAA , 0xBB ] ,
629+ array_bits : [ 0xCC , 0xDD ] ,
630+
631+ array_implicit_bytes : [ 0 , 1 ] ,
632+ array_implicit_bits : [ 2 , 3 ] ,
633+
634+ array_explicit_bytes : [ 4 , 5 ] ,
635+ array_explicit_bits : [ 6 , 7 ] ,
636+
637+ array_optional_implicit_bits : Some ( [ 8 , 9 ] ) ,
638+ array_optional_implicit_bytes : Some ( [ 10 , 11 ] ) ,
639+
640+ array_optional_explicit_bits : Some ( [ 12 , 13 ] ) ,
641+ array_optional_explicit_bytes : Some ( [ 14 , 15 ] ) ,
642+ } ;
643+
644+ let der_encoded = obj. to_der ( ) . unwrap ( ) ;
645+ let obj_decoded =
646+ TypeCheckArraysSequenceFieldAttributeCombinations :: from_der ( & der_encoded) . unwrap ( ) ;
647+ assert_eq ! ( obj, obj_decoded) ;
648+ }
649+
571650 #[ derive( Sequence ) ]
572651 #[ asn1( error = CustomError ) ]
573652 pub struct TypeWithCustomError {
0 commit comments