diff options
Diffstat (limited to 'lib/asn1/test')
-rw-r--r-- | lib/asn1/test/asn1_SUITE_data/ValueTest.asn | 30 | ||||
-rw-r--r-- | lib/asn1/test/error_SUITE.erl | 21 | ||||
-rw-r--r-- | lib/asn1/test/testValueTest.erl | 11 |
3 files changed, 61 insertions, 1 deletions
diff --git a/lib/asn1/test/asn1_SUITE_data/ValueTest.asn b/lib/asn1/test/asn1_SUITE_data/ValueTest.asn index 156d23ee62..b2c59d686a 100644 --- a/lib/asn1/test/asn1_SUITE_data/ValueTest.asn +++ b/lib/asn1/test/asn1_SUITE_data/ValueTest.asn @@ -110,4 +110,34 @@ otherOctetString OCTET STRING ::= someOctetString os-1 OCTET STRING ::= os-2 os-2 OCTET STRING ::= os-holder-1.&os +-- Recursive BIT STRING definitions. + +BS-HOLDER ::= CLASS { + &id INTEGER UNIQUE, + &bs BIT STRING, + &named-bs NamedBsType +} WITH SYNTAX { + ID &id BS &bs NAMED-BS &named-bs +} +bs-holder-1 BS-HOLDER ::= { ID 1 BS '101'B NAMED-BS {a,c} } + +NamedBsType ::= BIT STRING {a(0),b(1),c(2)} +BsSeq ::= SEQUENCE { + a BIT STRING, + b NamedBsType +} + +someBitString BIT STRING ::= '101101'B + +bsSeq1 BsSeq ::= { a someBitString, b someNamedBs } +bsSeq2 BsSeq ::= { a otherBitString, b someOtherNamedBs } +bsSeq3 BsSeq ::= { a bs-holder-1.&bs, b bs-holder-1.&named-bs } + +otherBitString BIT STRING ::= someBitString +bsFromObjectInd BIT STRING ::= bsFromObject +bsFromObject BIT STRING ::= bs-holder-1.&bs + +someOtherNamedBs NamedBsType ::= someNamedBs +someNamedBs NamedBsType ::= {c} + END diff --git a/lib/asn1/test/error_SUITE.erl b/lib/asn1/test/error_SUITE.erl index 4534abc0c4..d83131db92 100644 --- a/lib/asn1/test/error_SUITE.erl +++ b/lib/asn1/test/error_SUITE.erl @@ -601,6 +601,13 @@ values(Config) -> " int6 INTEGER ::= holder-2.&undefined-field\n" " int7 INTEGER ::= holder-2.&UndefinedField.&id\n" + " bs1 BIT STRING ::= 42\n" + " bs2 BIT STRING ::= {a,b}\n" + " bs3 BIT STRING {a(0),z(25)} ::= {a,b}\n" + " bs4 BIT STRING {a(0),z(25)} ::= int\n" + " bs5 BIT STRING ::= holder-2.&str\n" + " bs6 BIT STRING ::= holder-2.&obj\n" + " HOLDER ::= CLASS {\n" " &str IA5String,\n" " &obj HOLDER OPTIONAL\n" @@ -638,7 +645,19 @@ values(Config) -> {structured_error,{M,17},asn1ct_check, {undefined_field,'undefined-field'}}, {structured_error,{M,18},asn1ct_check, - {undefined_field,'UndefinedField'}} + {undefined_field,'UndefinedField'}}, + {structured_error,{M,19},asn1ct_check, + illegal_bitstring_value}, + {structured_error,{M,20},asn1ct_check, + illegal_bitstring_value}, + {structured_error,{M,21},asn1ct_check, + illegal_bitstring_value}, + {structured_error,{M,22},asn1ct_check, + illegal_bitstring_value}, + {structured_error,{M,23},asn1ct_check, + illegal_bitstring_value}, + {structured_error,{M,24},asn1ct_check, + illegal_bitstring_value} ] } = run(P, Config), ok. diff --git a/lib/asn1/test/testValueTest.erl b/lib/asn1/test/testValueTest.erl index d1532c3ef0..8a8e973621 100644 --- a/lib/asn1/test/testValueTest.erl +++ b/lib/asn1/test/testValueTest.erl @@ -88,6 +88,17 @@ main() -> <<16#40,16#41,16#FF>> = M:'os-1'(), <<16#40,16#41,16#FF>> = M:'os-2'(), + %% Recursive BIT STRING definitions. + {'BsSeq',<<2#101101:6>>,[c]} = M:bsSeq1(), + {'BsSeq',<<2#101101:6>>,[c]} = M:bsSeq2(), + {'BsSeq',<<2#101:3>>,[a,c]} = M:bsSeq3(), + <<2#101101:6>> = M:someBitString(), + <<2#101101:6>> = M:otherBitString(), + <<2#101:3>> = M:bsFromObject(), + <<2#101:3>> = M:bsFromObjectInd(), + [c] = M:someNamedBs(), + [c] = M:someOtherNamedBs(), + ok. |