aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test
diff options
context:
space:
mode:
authorGustav Simonsson <[email protected]>2012-07-05 16:37:42 +0200
committerGustav Simonsson <[email protected]>2012-07-05 16:45:18 +0200
commit6ddf21fafe0846f3df0391ec785a91aaa4062bd5 (patch)
tree1c56228c0111d764e2928912dc53ad1211fd6543 /lib/asn1/test
parent14f6a66f6410e1665ad39e95158420b0a45634d6 (diff)
downloadotp-6ddf21fafe0846f3df0391ec785a91aaa4062bd5.tar.gz
otp-6ddf21fafe0846f3df0391ec785a91aaa4062bd5.tar.bz2
otp-6ddf21fafe0846f3df0391ec785a91aaa4062bd5.zip
Add sorting in constraint checking on single values.
Fix a bug where a subtyped single value integer type where one or more values were predefined would result in generated encoding code having faulty range checks. See seq12102. OTP-10139
Diffstat (limited to 'lib/asn1/test')
-rw-r--r--lib/asn1/test/asn1_SUITE_data/Constraints.py2
-rw-r--r--lib/asn1/test/testConstraints.erl14
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/asn1/test/asn1_SUITE_data/Constraints.py b/lib/asn1/test/asn1_SUITE_data/Constraints.py
index de48c4c2ca..bac50a5df0 100644
--- a/lib/asn1/test/asn1_SUITE_data/Constraints.py
+++ b/lib/asn1/test/asn1_SUITE_data/Constraints.py
@@ -4,6 +4,8 @@ BEGIN
-- Single Value
SingleValue ::= INTEGER (1)
SingleValue2 ::= INTEGER (1..20)
+predefined INTEGER ::= 1
+SingleValue3 ::= INTEGER (predefined | 5 | 10)
Range2to19 ::= INTEGER (1<..<20)
Range10to20 ::= INTEGER (10..20)
ContainedSubtype ::= INTEGER (INCLUDES Range10to20)
diff --git a/lib/asn1/test/testConstraints.erl b/lib/asn1/test/testConstraints.erl
index 1ce68ec522..4dc71ca6c4 100644
--- a/lib/asn1/test/testConstraints.erl
+++ b/lib/asn1/test/testConstraints.erl
@@ -86,7 +86,21 @@ int_constraints(Rules) ->
asn1_wrapper:encode('Constraints','SingleValue',1000)
end,
+ %%==========================================================
+ %% SingleValue3 ::= INTEGER (Predefined | 5 | 10)
+ %% Testcase for OTP-10139. A single value subtyping of an integer type
+ %% where one value is predefined.
+ %%==========================================================
+ ?line {ok,BytesSV3} = asn1_wrapper:encode('Constraints','SingleValue3',1),
+ ?line {ok,1} = asn1_wrapper:decode('Constraints','SingleValue3',
+ lists:flatten(BytesSV3)),
+ ?line {ok,BytesSV3_2} = asn1_wrapper:encode('Constraints','SingleValue3',5),
+ ?line {ok,5} = asn1_wrapper:decode('Constraints','SingleValue3',
+ lists:flatten(BytesSV3_2)),
+ ?line {ok,BytesSV3_3} = asn1_wrapper:encode('Constraints','SingleValue3',10),
+ ?line {ok,10} = asn1_wrapper:decode('Constraints','SingleValue3',
+ lists:flatten(BytesSV3_3)),
%%==========================================================
%% Range2to19 ::= INTEGER (1<..<20)