aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-10-31 15:22:40 +0100
committerBjörn Gustavsson <[email protected]>2015-01-12 11:40:26 +0100
commit6d9725178dd44aa0337901b081be93113f988167 (patch)
tree39d5aae6d5c9991966c16e56a9c4067be4134c2b /lib/asn1/test
parentd17a84df58177143c89180aeb85373e0d5504210 (diff)
downloadotp-6d9725178dd44aa0337901b081be93113f988167.tar.gz
otp-6d9725178dd44aa0337901b081be93113f988167.tar.bz2
otp-6d9725178dd44aa0337901b081be93113f988167.zip
Clean up and correct table constraint handling
Diffstat (limited to 'lib/asn1/test')
-rw-r--r--lib/asn1/test/asn1_SUITE_data/InfObj.asn17
-rw-r--r--lib/asn1/test/error_SUITE.erl42
-rw-r--r--lib/asn1/test/testInfObj.erl4
3 files changed, 61 insertions, 2 deletions
diff --git a/lib/asn1/test/asn1_SUITE_data/InfObj.asn b/lib/asn1/test/asn1_SUITE_data/InfObj.asn
index 420cc99c4c..2bf1dc0921 100644
--- a/lib/asn1/test/asn1_SUITE_data/InfObj.asn
+++ b/lib/asn1/test/asn1_SUITE_data/InfObj.asn
@@ -440,6 +440,21 @@ INDIRECTED-CLASS ::= CLASS {
INDIRECT-CLASS ::= INDIRECTED-CLASS
-END
+--
+-- Indirect ObjectClassFieldType in a SEQUENCE.
+--
+
+ContentInfo ::= SEQUENCE {
+ contentType ContentType, -- Indirect ObjectClassFieldType
+ content TYPE-IDENTIFIER.&Type({Contents}{@contentType})
+OPTIONAL
+}
+
+Contents TYPE-IDENTIFIER ::= {
+ {IA5String IDENTIFIED BY id-content-type}
+}
+ContentType ::= TYPE-IDENTIFIER.&id({Contents})
+id-content-type ContentType ::= { 2 7 8 9 }
+END
diff --git a/lib/asn1/test/error_SUITE.erl b/lib/asn1/test/error_SUITE.erl
index d83131db92..0fe77e7b22 100644
--- a/lib/asn1/test/error_SUITE.erl
+++ b/lib/asn1/test/error_SUITE.erl
@@ -23,7 +23,8 @@
classes/1,constraints/1,enumerated/1,
imports/1,instance_of/1,integers/1,objects/1,
object_field_extraction/1,oids/1,rel_oids/1,
- object_sets/1,parameterization/1, syntax/1,values/1]).
+ object_sets/1,parameterization/1,
+ syntax/1,table_constraints/1,values/1]).
-include_lib("test_server/include/test_server.hrl").
@@ -49,6 +50,7 @@ groups() ->
rel_oids,
parameterization,
syntax,
+ table_constraints,
values]}].
parallel() ->
@@ -578,6 +580,44 @@ syntax(Config) ->
} = run(P, Config),
ok.
+table_constraints(Config) ->
+ M = 'TableConstraints',
+ P = {M,
+ <<"TableConstraints DEFINITIONS AUTOMATIC TAGS ::= BEGIN\n"
+ " Seq-1 ::= SEQUENCE {\n"
+ " contentType CONTENTS.&id,\n"
+ " content CONTENTS.&Type({Contents}{@contentType})\n"
+ " }\n"
+
+ " Seq-2 ::= SEQUENCE {\n"
+ " contentType INTEGER({Contents}),\n"
+ " content CONTENTS.&Type({Contents}{@contentType})\n"
+ " }\n"
+
+ " Seq-3 ::= SEQUENCE {\n"
+ " contentType INTEGER,\n"
+ " content CONTENTS.&Type({Contents}{@contentType})\n"
+ " }\n"
+
+ "Contents CONTENTS ::= {\n"
+ " {OCTET STRING IDENTIFIED BY {2 1 1}}\n"
+ "}\n"
+
+ "CONTENTS ::= TYPE-IDENTIFIER\n"
+ "END\n">>},
+ {error,
+ [{structured_error,
+ {M,2},asn1ct_check,
+ {missing_table_constraint,contentType}},
+ {structured_error,
+ {M,6},asn1ct_check,
+ {missing_ocft,contentType}},
+ {structured_error,
+ {M,10},asn1ct_check,
+ {missing_ocft,contentType}}
+ ]} = run(P, Config),
+ ok.
+
values(Config) ->
M = 'Values',
P = {M,
diff --git a/lib/asn1/test/testInfObj.erl b/lib/asn1/test/testInfObj.erl
index accdcf8dff..0b59cb35b5 100644
--- a/lib/asn1/test/testInfObj.erl
+++ b/lib/asn1/test/testInfObj.erl
@@ -156,6 +156,10 @@ main(_Erule) ->
roundtrip('InfObj', 'TiAliasSeq',
{'TiAliasSeq',{'TiAliasSeq_prf',{2,1,2},'NULL'}}),
+ roundtrip('InfObj', 'ContentInfo',
+ {'ContentInfo',{2,7,8,9},"string"}),
+ {2,7,8,9} = 'InfObj':'id-content-type'(),
+
ok.
test_objset(Type, Keys) ->