aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-08-28 07:51:09 +0200
committerBjörn Gustavsson <[email protected]>2013-08-30 10:13:17 +0200
commit9096522efd263f719ab9bc56670406a73ac1d818 (patch)
tree802565085ae150c8aac9d88b852e4b289ed70e7c /lib
parent280c6a1d35f39eb285d4d9e41ffa3e7ae298e41a (diff)
downloadotp-9096522efd263f719ab9bc56670406a73ac1d818.tar.gz
otp-9096522efd263f719ab9bc56670406a73ac1d818.tar.bz2
otp-9096522efd263f719ab9bc56670406a73ac1d818.zip
Test OPTIONAL and DEFAULT for open types
Diffstat (limited to 'lib')
-rw-r--r--lib/asn1/test/asn1_SUITE_data/InfObj.asn13
-rw-r--r--lib/asn1/test/testInfObj.erl10
2 files changed, 22 insertions, 1 deletions
diff --git a/lib/asn1/test/asn1_SUITE_data/InfObj.asn b/lib/asn1/test/asn1_SUITE_data/InfObj.asn
index dd0296526f..ed19c40836 100644
--- a/lib/asn1/test/asn1_SUITE_data/InfObj.asn
+++ b/lib/asn1/test/asn1_SUITE_data/InfObj.asn
@@ -219,6 +219,19 @@ ConstructedSet ::= SET {
content [1] CONSTRUCTED-DEFAULT.&Type ({ConstructedDefaultSet}{@id})
}
+-- Test OPTIONAL and DEFAULT
+
+OptionalInSeq ::= SEQUENCE {
+ id CONSTRUCTED-DEFAULT.&id ({ConstructedDefaultSet}),
+ content CONSTRUCTED-DEFAULT.&Type ({ConstructedDefaultSet}{@id}) OPTIONAL
+}
+
+DefaultInSeq ::= SEQUENCE {
+ id CONSTRUCTED-DEFAULT.&id ({ConstructedDefaultSet}),
+ content CONSTRUCTED-DEFAULT.&Type ({ConstructedDefaultSet}{@id})
+ DEFAULT BOOLEAN:TRUE
+}
+
END
diff --git a/lib/asn1/test/testInfObj.erl b/lib/asn1/test/testInfObj.erl
index 2b751f7fb7..7241f7b380 100644
--- a/lib/asn1/test/testInfObj.erl
+++ b/lib/asn1/test/testInfObj.erl
@@ -99,7 +99,15 @@ main(_Erule) ->
roundtrip('InfObj', 'Seq2',
{'Seq2',42,[true,false,false,true],
- [false,true,false]}).
+ [false,true,false]}),
+
+ roundtrip('InfObj', 'OptionalInSeq', {'OptionalInSeq',3,true}),
+ roundtrip('InfObj', 'OptionalInSeq', {'OptionalInSeq',3,asn1_NOVALUE}),
+
+ roundtrip('InfObj', 'DefaultInSeq', {'DefaultInSeq',3,false}),
+ roundtrip('InfObj', 'DefaultInSeq', {'DefaultInSeq',3,true}),
+ {'DefaultInSeq',3,true} =
+ enc_dec('InfObj', 'DefaultInSeq', {'DefaultInSeq',3,asn1_DEFAULT}).
roundtrip(M, T, V) ->