diff options
Diffstat (limited to 'lib/asn1/test')
-rw-r--r-- | lib/asn1/test/asn1_SUITE.erl | 5 | ||||
-rw-r--r-- | lib/asn1/test/testMergeCompile.erl | 3 | ||||
-rw-r--r-- | lib/asn1/test/testParameterizedInfObj.erl | 70 |
3 files changed, 46 insertions, 32 deletions
diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index 1c4eb583cf..3b34feb5a3 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -771,7 +771,10 @@ testParameterizedInfObj(Config) -> testParameterizedInfObj(Config, Rule, Opts) -> Files = ["Param","Param2"], asn1_test_lib:compile_all(Files, Config, [Rule|Opts]), - testParameterizedInfObj:main(Config, Rule). + testParameterizedInfObj:main(Config, Rule), + asn1_test_lib:compile("Param", Config, + [legacy_erlang_types,Rule|Opts]), + testParameterizedInfObj:param(Rule). testFragmented(Config) -> test(Config, fun testFragmented/3). diff --git a/lib/asn1/test/testMergeCompile.erl b/lib/asn1/test/testMergeCompile.erl index b6532b338e..b21897cfc2 100644 --- a/lib/asn1/test/testMergeCompile.erl +++ b/lib/asn1/test/testMergeCompile.erl @@ -35,7 +35,7 @@ main(Erule) -> %% test of RANAP.set.asn1 PIEVal2 = [{'ProtocolIE-Field',4,ignore,{radioNetwork,'rab-pre-empted'}}], - EncVal = + EncVal0 = case Erule of per -> <<1,100>>; @@ -44,6 +44,7 @@ main(Erule) -> ber -> <<2,1,1>> end, + EncVal = {asn1_OPENTYPE,EncVal0}, PEVal2 = [{'ProtocolExtensionField',1,ignore,EncVal}, {'ProtocolExtensionField',2,reject,EncVal}], Val2 = diff --git a/lib/asn1/test/testParameterizedInfObj.erl b/lib/asn1/test/testParameterizedInfObj.erl index 17abbdb102..2fe900792d 100644 --- a/lib/asn1/test/testParameterizedInfObj.erl +++ b/lib/asn1/test/testParameterizedInfObj.erl @@ -20,7 +20,7 @@ -module(testParameterizedInfObj). --export([main/2,ranap/1]). +-export([main/2,param/1,ranap/1]). -include_lib("test_server/include/test_server.hrl"). @@ -36,31 +36,29 @@ main(Config, Erule) -> param2(Config, Erule). param(Erule) -> - PERVal = #'AllocationOrRetentionPriority' - {priorityLevel = true, - iE_Extensions = - [#'ProtocolExtensionField'{id=14, - criticality=reject, - extensionValue= <<0>>}, - #'ProtocolExtensionField'{id=2, - criticality=ignore, - extensionValue= <<1>>}]}, - BERVal = #'AllocationOrRetentionPriority' - {priorityLevel = true, - iE_Extensions = - [#'ProtocolExtensionField'{id=14, - criticality=reject, - extensionValue= <<2,1,0>>}, - #'ProtocolExtensionField'{id=2, - criticality=ignore, - extensionValue= <<2,1,1>>}]}, - case Erule of - ber -> - roundtrip('AllocationOrRetentionPriority', BERVal); - per -> - roundtrip('AllocationOrRetentionPriority', PERVal); - uper -> - roundtrip('AllocationOrRetentionPriority', PERVal) + Exts0 = case Erule of + ber -> + %% As implemented, the open type must contain + %% valid BER-encoded data. + [{14,<<2,1,0>>},{2,<<2,1,0>>}]; + _ -> + %% The PER decoder will not look inside the open type. + [{14,<<0>>},{2,<<"anything goes">>}] + end, + case 'Param':legacy_erlang_types() of + false -> + Exts = [#'ProtocolExtensionField'{id=Id, + criticality=reject, + extensionValue={asn1_OPENTYPE, + Eval}} || + {Id,Eval} <- Exts0], + aor_roundtrip(Exts); + true -> + Exts = [#'ProtocolExtensionField'{id=Id, + criticality=reject, + extensionValue=Eval} || + {Id,Eval} <- Exts0], + aor_roundtrip(Exts) end, %% test code for OTP-4242, ValueFromObject @@ -72,8 +70,13 @@ param(Erule) -> {error,_Reason2} = 'Param':decode('OS2',[4,4,1,2,3,4]), {ok,_Val4} = 'Param':decode('OS1',[4,2,1,2]); _ -> %per/uper - roundtrip('OS1', <<1,2>>), - {error,_Reason3} = 'Param':encode('OS1', <<1,2,3,4>>) + case 'Param':legacy_erlang_types() of + false -> + roundtrip('OS1', <<1,2>>), + {error,_Reason3} = 'Param':encode('OS1', <<1,2,3,4>>); + true -> + ok + end end, roundtrip('Scl', {'Scl',42,{a,9738654}}), @@ -82,6 +85,11 @@ param(Erule) -> ok. +aor_roundtrip(Exts) -> + Val = #'AllocationOrRetentionPriority'{priorityLevel = true, + iE_Extensions = Exts}, + roundtrip('AllocationOrRetentionPriority', Val). + roundtrip(T, V) -> asn1_test_lib:roundtrip('Param', T, V). @@ -129,8 +137,10 @@ param2(Config, Erule) -> %% Decompile extended data. {ok,{'HandoverRequired',[{'ProtocolIE-Field',1,<<"ABC">>}, {'ProtocolIE-Field',2,-42}, - {'ProtocolIE-Field',100,Open100}, - {'ProtocolIE-Field',101,Open101}]}} = + {'ProtocolIE-Field',100, + {asn1_OPENTYPE,Open100}}, + {'ProtocolIE-Field',101, + {asn1_OPENTYPE,Open101}}]}} = 'Param2':decode('HandoverRequired', Enc), true = is_binary(Open100), true = is_binary(Open101), |