aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-07-12 08:21:26 +0200
committerBjörn Gustavsson <[email protected]>2013-08-30 10:13:16 +0200
commitbf13576de7f8a3cd56a268e3bf9cdf6535ea2334 (patch)
treeaf834c5f8a1064b61b38db8736bd5dea6655e930 /lib/asn1/test
parent8b1a8bfb5d339350979341a39eb6ad6c338d6147 (diff)
downloadotp-bf13576de7f8a3cd56a268e3bf9cdf6535ea2334.tar.gz
otp-bf13576de7f8a3cd56a268e3bf9cdf6535ea2334.tar.bz2
otp-bf13576de7f8a3cd56a268e3bf9cdf6535ea2334.zip
Extend the test for parameterized information objects
Diffstat (limited to 'lib/asn1/test')
-rw-r--r--lib/asn1/test/asn1_SUITE_data/Param.asn122
-rw-r--r--lib/asn1/test/testParameterizedInfObj.erl10
2 files changed, 32 insertions, 0 deletions
diff --git a/lib/asn1/test/asn1_SUITE_data/Param.asn1 b/lib/asn1/test/asn1_SUITE_data/Param.asn1
index b2987a7885..4eff0da781 100644
--- a/lib/asn1/test/asn1_SUITE_data/Param.asn1
+++ b/lib/asn1/test/asn1_SUITE_data/Param.asn1
@@ -88,6 +88,28 @@ POS2 {CONFIG-DATA:obj} ::= OCTET STRING (SIZE(obj.&minLevel .. obj.&maxLevel))
OS2 ::= POS2 {config-data}
+--
+-- Test a CLASS without the user-friendly syntax.
+--
+
+CL ::= CLASS {
+ &code INTEGER UNIQUE,
+ &Data
+}
+
+P{T} ::= CHOICE { a INTEGER, b T }
+
+o1 CL ::= {
+ &code 42,
+ &Data P{BOOLEAN}
+}
+
+SetCL CL ::= { o1 }
+
+Scl ::= SEQUENCE {
+ code CL.&code ({SetCL}),
+ data CL.&Data ({SetCL}{@code})
+}
END
diff --git a/lib/asn1/test/testParameterizedInfObj.erl b/lib/asn1/test/testParameterizedInfObj.erl
index 1dfa52f401..02847e502b 100644
--- a/lib/asn1/test/testParameterizedInfObj.erl
+++ b/lib/asn1/test/testParameterizedInfObj.erl
@@ -86,8 +86,18 @@ param(Erule) ->
asn1_wrapper:encode('Param','OS1',[1,2,3,4])
end,
+ roundtrip('Scl', {'Scl',42,{a,9738654}}),
+ roundtrip('Scl', {'Scl',42,{b,false}}),
+ roundtrip('Scl', {'Scl',42,{b,true}}),
+
+ ok.
+
+roundtrip(T, V) ->
+ {ok,Enc} = 'Param':encode(T, V),
+ {ok,V} = 'Param':decode(T, Enc),
ok.
+
ranap(_Erule) ->
PIEVal2 = [{'ProtocolIE-Field',4,ignore,{radioNetwork,'rab-pre-empted'}}],
?line Val2 =