aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-11-06 13:04:52 +0100
committerBjörn Gustavsson <[email protected]>2015-01-12 11:40:27 +0100
commitfa8dfc8aa8ae99526a3dc1faa2baaadff51117fb (patch)
treef474ee63df4a992053842e1e3f5b9e6d7de762ee /lib/asn1/test
parent1b8e14c290d1b7fb8b89b3139ab10c4623afb031 (diff)
downloadotp-fa8dfc8aa8ae99526a3dc1faa2baaadff51117fb.tar.gz
otp-fa8dfc8aa8ae99526a3dc1faa2baaadff51117fb.tar.bz2
otp-fa8dfc8aa8ae99526a3dc1faa2baaadff51117fb.zip
Rewrite handling of ObjectSetFromObjects
The ObjectSetFromObjects construct is implemented using the object_set_from_objects() function, which is similar to get_fieldname_element(). Rewrite the ObjectSetFromObjects handling to use get_fieldname_element() to share more code.
Diffstat (limited to 'lib/asn1/test')
-rw-r--r--lib/asn1/test/asn1_SUITE_data/InfObjExtract.asn136
-rw-r--r--lib/asn1/test/testInfObjExtract.erl8
2 files changed, 44 insertions, 0 deletions
diff --git a/lib/asn1/test/asn1_SUITE_data/InfObjExtract.asn1 b/lib/asn1/test/asn1_SUITE_data/InfObjExtract.asn1
index 0ee8e178fd..6a614f546c 100644
--- a/lib/asn1/test/asn1_SUITE_data/InfObjExtract.asn1
+++ b/lib/asn1/test/asn1_SUITE_data/InfObjExtract.asn1
@@ -83,4 +83,40 @@ DataSeq-4 ::= TestSeq{ {holder-object-5.&ObjSet} }
DataSeq-5 ::= TestSeq{ {holder-object-6.&ObjSet} }
DataSeq-6 ::= TestSeq{ {holder-object-7.&ObjSet} }
+--
+-- Test ObjectSetFromObjects.
+--
+
+OBJ-CLASS ::= CLASS {
+ &id INTEGER UNIQUE,
+ &Data OPTIONAL,
+ &Obj OBJ-CLASS OPTIONAL,
+ &obj OBJ-CLASS OPTIONAL
+}
+
+obj-class-obj-1 OBJ-CLASS ::= { &id 1, &Data BOOLEAN }
+
+obj-class-obj-2 OBJ-CLASS ::= { &id 2, &Data BOOLEAN,
+ &Obj {obj-class-obj-1} }
+
+obj-class-obj-3 OBJ-CLASS ::= { &id 3, &Data BOOLEAN,
+ &obj {&id 99, &Obj {obj-class-obj-1}} }
+
+obj-class-obj-4 OBJ-CLASS ::= { &id 4, &Data BOOLEAN, &obj obj-class-obj-2 }
+
+obj-class-obj-5 OBJ-CLASS ::= { &id 5, &Data BOOLEAN,
+ &Obj {obj-class-obj-4.&obj} }
+
+ObjClassSet OBJ-CLASS ::= { obj-class-obj-3.&obj.&Obj |
+ obj-class-obj-4.&Obj | -- Non-existing field
+ obj-class-obj-5.&Obj
+ }
+
+TestObjClassSeq{OBJ-CLASS:ObjectSet} ::= SEQUENCE {
+ id OBJ-CLASS.&id ({ObjectSet}),
+ data OBJ-CLASS.&Data ({ObjectSet}{@id})
+}
+
+ObjClassSeq-1 ::= TestObjClassSeq{{ObjClassSet}}
+
END
diff --git a/lib/asn1/test/testInfObjExtract.erl b/lib/asn1/test/testInfObjExtract.erl
index d3ea368391..f86626d037 100644
--- a/lib/asn1/test/testInfObjExtract.erl
+++ b/lib/asn1/test/testInfObjExtract.erl
@@ -32,6 +32,14 @@ main() ->
roundtrip_data_object_13('DataSeq-5'),
roundtrip_data_object_13('DataSeq-6'),
+ roundtrip('ObjClassSeq-1', {'ObjClassSeq-1',1,true}),
+ roundtrip('ObjClassSeq-1', {'ObjClassSeq-1',2,true}),
+
+ roundtrip_error('ObjClassSeq-1', {'ObjClassSeq-1',0,false}),
+ roundtrip_error('ObjClassSeq-1', {'ObjClassSeq-1',3,true}),
+ roundtrip_error('ObjClassSeq-1', {'ObjClassSeq-1',4,false}),
+ roundtrip_error('ObjClassSeq-1', {'ObjClassSeq-1',5,true}),
+
ok.
roundtrip_data_object_13(SeqType) ->