aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test
diff options
context:
space:
mode:
Diffstat (limited to 'lib/asn1/test')
-rw-r--r--lib/asn1/test/asn1_SUITE_data/ValueTest.asn24
-rw-r--r--lib/asn1/test/error_SUITE.erl28
-rw-r--r--lib/asn1/test/testValueTest.erl10
3 files changed, 55 insertions, 7 deletions
diff --git a/lib/asn1/test/asn1_SUITE_data/ValueTest.asn b/lib/asn1/test/asn1_SUITE_data/ValueTest.asn
index 51da9d8afb..739c8a4e45 100644
--- a/lib/asn1/test/asn1_SUITE_data/ValueTest.asn
+++ b/lib/asn1/test/asn1_SUITE_data/ValueTest.asn
@@ -79,4 +79,28 @@ int-holder-2 INT-HOLDER ::= { ID 4 OBJ int-holder-1 }
II ::= INTEGER (int-from-object-1..int-from-object-2)
+-- Recursive OCTET STRING definitions.
+
+OS-HOLDER ::= CLASS {
+ &id INTEGER UNIQUE,
+ &os OCTET STRING
+} WITH SYNTAX {
+ ID &id OS &os
+}
+
+os-holder-1 OS-HOLDER ::= { ID 1 OS '4041FF'H }
+
+OctetStringSeq ::= ParamSeq{OCTET STRING}
+
+someOctetString OCTET STRING ::= '404142'H
+
+octetStringSeq1 OctetStringSeq ::= { a someOctetString }
+octetStringSeq2 OctetStringSeq ::= { a otherOctetString }
+octetStringSeq3 OctetStringSeq ::= { a os-holder-1.&os }
+
+otherOctetString OCTET STRING ::= someOctetString
+
+os-1 OCTET STRING ::= os-2
+os-2 OCTET STRING ::= os-holder-1.&os
+
END
diff --git a/lib/asn1/test/error_SUITE.erl b/lib/asn1/test/error_SUITE.erl
index 6c4920dcf7..35ca9a2f5e 100644
--- a/lib/asn1/test/error_SUITE.erl
+++ b/lib/asn1/test/error_SUITE.erl
@@ -412,6 +412,12 @@ values(Config) ->
" os2 OCTET STRING ::= 42\n"
" os3 OCTET STRING ::= { 1, 3 }\n"
" os4 OCTET STRING ::= '1234'H\n"
+ " Seq ::= SEQUENCE {\n"
+ " an OCTET STRING\n"
+ " }\n"
+ " seq Seq ::= { an int }\n"
+ " os5 OCTET STRING ::= holder-1.&str\n"
+ " os6 OCTET STRING ::= int\n"
" int1 INTEGER ::= \"string\"\n"
" int2 INTEGER ::= os4\n"
@@ -428,6 +434,8 @@ values(Config) ->
" holder-1 HOLDER ::= { &str \"xyz\" }\n"
" holder-2 HOLDER ::= { &str \"xyz\", &obj holder-1 }\n"
+
+ " int INTEGER ::= 42\n"
"END\n">>},
{error,
[
@@ -437,19 +445,25 @@ values(Config) ->
illegal_octet_string_value},
{structured_error,{M,4},asn1ct_check,
illegal_octet_string_value},
- {structured_error,{M,6},asn1ct_check,
+ {structured_error,{M,9},asn1ct_check,
+ illegal_octet_string_value},
+ {structured_error,{M,10},asn1ct_check,
+ illegal_octet_string_value},
+ {structured_error,{M,11},asn1ct_check,
+ illegal_octet_string_value},
+ {structured_error,{M,12},asn1ct_check,
illegal_integer_value},
- {structured_error,{M,7},asn1ct_check,
+ {structured_error,{M,13},asn1ct_check,
illegal_integer_value},
- {structured_error,{M,8},asn1ct_check,
+ {structured_error,{M,14},asn1ct_check,
illegal_integer_value},
- {structured_error,{M,9},asn1ct_check,
+ {structured_error,{M,15},asn1ct_check,
illegal_integer_value},
- {structured_error,{M,10},asn1ct_check,
+ {structured_error,{M,16},asn1ct_check,
illegal_integer_value},
- {structured_error,{M,11},asn1ct_check,
+ {structured_error,{M,17},asn1ct_check,
{undefined_field,'undefined-field'}},
- {structured_error,{M,12},asn1ct_check,
+ {structured_error,{M,18},asn1ct_check,
{undefined_field,'UndefinedField'}}
]
} = run(P, Config),
diff --git a/lib/asn1/test/testValueTest.erl b/lib/asn1/test/testValueTest.erl
index d9cc3de5eb..24a2862b40 100644
--- a/lib/asn1/test/testValueTest.erl
+++ b/lib/asn1/test/testValueTest.erl
@@ -72,8 +72,18 @@ main() ->
roundtrip('II', 4),
roundtrip_error('II', 5),
+ %% Recursive value definitions.
+ {'OctetStringSeq',<<16#40,16#41,16#42>>} = M:octetStringSeq1(),
+ <<16#40,16#41,16#42>> = M:otherOctetString(),
+ <<16#40,16#41,16#42>> = M:someOctetString(),
+ {'OctetStringSeq',<<16#40,16#41,16#42>>} = M:octetStringSeq2(),
+ {'OctetStringSeq',<<16#40,16#41,16#FF>>} = M:octetStringSeq3(),
+ <<16#40,16#41,16#FF>> = M:'os-1'(),
+ <<16#40,16#41,16#FF>> = M:'os-2'(),
+
ok.
+
roundtrip(T, V) ->
asn1_test_lib:roundtrip('ValueTest', T, V).