diff options
author | Gustav Simonsson <[email protected]> | 2012-08-15 17:29:19 +0200 |
---|---|---|
committer | Gustav Simonsson <[email protected]> | 2012-08-15 17:29:19 +0200 |
commit | d7b165788d2aec28a652281a4c4310bda95c4fbf (patch) | |
tree | 7113793add62e8d7be730a3ca45ad0aaf2163fcc /lib/asn1/test | |
parent | 80cada1182d0a1a8afc84e3c3fa316bcf5649736 (diff) | |
parent | cc665e1ccb2cfc14a1ac8afefdc7af715ef5dee4 (diff) | |
download | otp-d7b165788d2aec28a652281a4c4310bda95c4fbf.tar.gz otp-d7b165788d2aec28a652281a4c4310bda95c4fbf.tar.bz2 otp-d7b165788d2aec28a652281a4c4310bda95c4fbf.zip |
Merge branch 'gustav/asn1/integer_single_value_predefined/OTP-10139' into maint
* gustav/asn1/integer_single_value_predefined/OTP-10139:
In generation of encoding functions for enumeration types,
the values used for generating the range check in case of
a value range should be sorted and have duplicates removed.
Add sorting in constraint checking on single values.
Conflicts:
lib/asn1/test/testConstraints.erl
Diffstat (limited to 'lib/asn1/test')
-rw-r--r-- | lib/asn1/test/asn1_SUITE_data/Constraints.py | 2 | ||||
-rw-r--r-- | lib/asn1/test/testConstraints.erl | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/asn1/test/asn1_SUITE_data/Constraints.py b/lib/asn1/test/asn1_SUITE_data/Constraints.py index dc65e7009a..87243121f7 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 d32e99eaaf..543c106e8a 100644 --- a/lib/asn1/test/testConstraints.erl +++ b/lib/asn1/test/testConstraints.erl @@ -85,6 +85,22 @@ int_constraints(Rules) -> 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) %%========================================================== |