aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test/testSeqOptional.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/asn1/test/testSeqOptional.erl')
-rw-r--r--lib/asn1/test/testSeqOptional.erl199
1 files changed, 44 insertions, 155 deletions
diff --git a/lib/asn1/test/testSeqOptional.erl b/lib/asn1/test/testSeqOptional.erl
index 8013f3c685..c9478105a4 100644
--- a/lib/asn1/test/testSeqOptional.erl
+++ b/lib/asn1/test/testSeqOptional.erl
@@ -37,159 +37,48 @@
-record('SeqChoOpt',{int, cho = asn1_NOVALUE}).
main(_Rules) ->
-
- ?line {ok,Bytes11} =
- asn1_wrapper:encode('SeqOptional','SeqOpt1',#'SeqOpt1'{bool1 = true,
- int1 = 15,
- seq1 = #'SeqIn'{boolIn = true,
- intIn = 66}}),
- ?line {ok,{'SeqOpt1',true,15,{'SeqIn',true,66}}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt1',lists:flatten(Bytes11)),
-
-
- ?line {ok,Bytes12} = asn1_wrapper:encode('SeqOptional','SeqOpt1',#'SeqOpt1'{int1 = 15}),
- ?line {ok,{'SeqOpt1',asn1_NOVALUE,15,asn1_NOVALUE}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt1',lists:flatten(Bytes12)),
-
-
- ?line {ok,Bytes21} =
- asn1_wrapper:encode('SeqOptional','SeqOpt2',#'SeqOpt2'{bool2 = true,
- int2 = 15,
- seq2 = #'SeqIn'{boolIn = true,
- intIn = 66}}),
- ?line {ok,{'SeqOpt2',{'SeqIn',true,66},true,15}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt2',lists:flatten(Bytes21)),
-
-
- ?line {ok,Bytes22} = asn1_wrapper:encode('SeqOptional','SeqOpt2',#'SeqOpt2'{int2 = 15,
- bool2 = true}),
- ?line {ok,{'SeqOpt2',asn1_NOVALUE,true,15}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt2',lists:flatten(Bytes22)),
-
-
-
- ?line {ok,Bytes31} =
- asn1_wrapper:encode('SeqOptional','SeqOpt3',#'SeqOpt3'{bool3 = true,
- int3 = 15,
- seq3 = #'SeqIn'{boolIn = true,
- intIn = 66}}),
- ?line {ok,{'SeqOpt3',true,{'SeqIn',true,66},15}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt3',lists:flatten(Bytes31)),
-
-
- ?line {ok,Bytes32} = asn1_wrapper:encode('SeqOptional','SeqOpt3',#'SeqOpt3'{int3 = 15}),
- ?line {ok,{'SeqOpt3',asn1_NOVALUE,asn1_NOVALUE,15}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt3',lists:flatten(Bytes32)),
-
-
-
-
-
- ?line {ok,Bytes41} =
- asn1_wrapper:encode('SeqOptional','SeqOpt1Imp',#'SeqOpt1Imp'{bool1 = true,
- int1 = 15,
- seq1 = #'SeqIn'{boolIn = true,
- intIn = 66}}),
- ?line {ok,{'SeqOpt1Imp',true,15,{'SeqIn',true,66}}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt1Imp',lists:flatten(Bytes41)),
-
-
- ?line {ok,Bytes42} = asn1_wrapper:encode('SeqOptional','SeqOpt1Imp',#'SeqOpt1Imp'{int1 = 15}),
- ?line {ok,{'SeqOpt1Imp',asn1_NOVALUE,15,asn1_NOVALUE}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt1Imp',lists:flatten(Bytes42)),
-
-
- ?line {ok,Bytes51} =
- asn1_wrapper:encode('SeqOptional','SeqOpt2Imp',#'SeqOpt2Imp'{bool2 = true,
- int2 = 15,
- seq2 = #'SeqIn'{boolIn = true,
- intIn = 66}}),
- ?line {ok,{'SeqOpt2Imp',{'SeqIn',true,66},true,15}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt2Imp',lists:flatten(Bytes51)),
-
-
- ?line {ok,Bytes52} = asn1_wrapper:encode('SeqOptional','SeqOpt2Imp',#'SeqOpt2Imp'{int2 = 15,
- bool2 = true}),
- ?line {ok,{'SeqOpt2Imp',asn1_NOVALUE,true,15}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt2Imp',lists:flatten(Bytes52)),
-
-
-
- ?line {ok,Bytes61} =
- asn1_wrapper:encode('SeqOptional','SeqOpt3Imp',#'SeqOpt3Imp'{bool3 = true,
- int3 = 15,
- seq3 = #'SeqIn'{boolIn = true,
- intIn = 66}}),
- ?line {ok,{'SeqOpt3Imp',true,{'SeqIn',true,66},15}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt3Imp',lists:flatten(Bytes61)),
-
-
- ?line {ok,Bytes62} = asn1_wrapper:encode('SeqOptional','SeqOpt3Imp',#'SeqOpt3Imp'{int3 = 15}),
- ?line {ok,{'SeqOpt3Imp',asn1_NOVALUE,asn1_NOVALUE,15}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt3Imp',lists:flatten(Bytes62)),
-
-
-
-
-
-
- ?line {ok,Bytes71} =
- asn1_wrapper:encode('SeqOptional','SeqOpt1Exp',#'SeqOpt1Exp'{bool1 = true,
- int1 = 15,
- seq1 = #'SeqIn'{boolIn = true,
- intIn = 66}}),
- ?line {ok,{'SeqOpt1Exp',true,15,{'SeqIn',true,66}}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt1Exp',lists:flatten(Bytes71)),
-
-
- ?line {ok,Bytes72} = asn1_wrapper:encode('SeqOptional','SeqOpt1Exp',#'SeqOpt1Exp'{int1 = 15}),
- ?line {ok,{'SeqOpt1Exp',asn1_NOVALUE,15,asn1_NOVALUE}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt1Exp',lists:flatten(Bytes72)),
-
-
- ?line {ok,Bytes81} =
- asn1_wrapper:encode('SeqOptional','SeqOpt2Exp',#'SeqOpt2Exp'{bool2 = true,
- int2 = 15,
- seq2 = #'SeqIn'{boolIn = true,
- intIn = 66}}),
- ?line {ok,{'SeqOpt2Exp',{'SeqIn',true,66},true,15}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt2Exp',lists:flatten(Bytes81)),
-
-
- ?line {ok,Bytes82} = asn1_wrapper:encode('SeqOptional','SeqOpt2Exp',#'SeqOpt2Exp'{int2 = 15,
- bool2 = true}),
- ?line {ok,{'SeqOpt2Exp',asn1_NOVALUE,true,15}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt2Exp',lists:flatten(Bytes82)),
-
-
-
- ?line {ok,Bytes91} =
- asn1_wrapper:encode('SeqOptional','SeqOpt3Exp',#'SeqOpt3Exp'{bool3 = true,
- int3 = 15,
- seq3 = #'SeqIn'{boolIn = true,
- intIn = 66}}),
- ?line {ok,{'SeqOpt3Exp',true,{'SeqIn',true,66},15}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt3Exp',lists:flatten(Bytes91)),
-
-
- ?line {ok,Bytes92} = asn1_wrapper:encode('SeqOptional','SeqOpt3Exp',#'SeqOpt3Exp'{int3 = 15}),
- ?line {ok,{'SeqOpt3Exp',asn1_NOVALUE,asn1_NOVALUE,15}} =
- asn1_wrapper:decode('SeqOptional','SeqOpt3Exp',lists:flatten(Bytes92)),
-
-
-
- ?line {ok,Bytes101} =
- asn1_wrapper:encode('SeqOptional','SeqChoOpt',#'SeqChoOpt'{int = 15,
- cho = {boolC,true}}),
- ?line {ok,{'SeqChoOpt',15,{boolC,true}}} =
- asn1_wrapper:decode('SeqOptional','SeqChoOpt',lists:flatten(Bytes101)),
-
-
- ?line {ok,Bytes102} = asn1_wrapper:encode('SeqOptional','SeqChoOpt',#'SeqChoOpt'{int = 15}),
- ?line {ok,{'SeqChoOpt',15,asn1_NOVALUE}} =
- asn1_wrapper:decode('SeqOptional','SeqChoOpt',lists:flatten(Bytes102)),
-
-
-
-
+ roundtrip('SeqOpt1', #'SeqOpt1'{bool1=true,int1=15,
+ seq1=#'SeqIn'{boolIn=true,intIn=66}}),
+ roundtrip('SeqOpt1', #'SeqOpt1'{bool1=asn1_NOVALUE,
+ int1=15,seq1=asn1_NOVALUE}),
+ roundtrip('SeqOpt2', #'SeqOpt2'{seq2=#'SeqIn'{boolIn=true,intIn=66},
+ bool2=true,int2=15}),
+ roundtrip('SeqOpt2', #'SeqOpt2'{seq2=asn1_NOVALUE,bool2=true,int2=15}),
+ roundtrip('SeqOpt3', #'SeqOpt3'{bool3=true,
+ seq3=#'SeqIn'{boolIn=true,
+ intIn=66},int3=15}),
+ roundtrip('SeqOpt3', #'SeqOpt3'{bool3=asn1_NOVALUE,
+ seq3=asn1_NOVALUE,int3=15}),
+ roundtrip('SeqOpt1Imp', #'SeqOpt1Imp'{bool1=true,int1=15,
+ seq1=#'SeqIn'{boolIn=true,intIn=66}}),
+ roundtrip('SeqOpt1Imp', #'SeqOpt1Imp'{bool1=asn1_NOVALUE,
+ int1=15,seq1=asn1_NOVALUE}),
+ roundtrip('SeqOpt2Imp', #'SeqOpt2Imp'{seq2=#'SeqIn'{boolIn=true,intIn=66},
+ bool2=true,int2=15}),
+ roundtrip('SeqOpt2Imp', #'SeqOpt2Imp'{seq2=asn1_NOVALUE,
+ bool2=true,int2=15}),
+ roundtrip('SeqOpt3Imp', #'SeqOpt3Imp'{bool3=true,
+ seq3=#'SeqIn'{boolIn=true,intIn=66},
+ int3=15}),
+ roundtrip('SeqOpt3Imp', #'SeqOpt3Imp'{bool3=asn1_NOVALUE,
+ seq3=asn1_NOVALUE,int3=15}),
+ roundtrip('SeqOpt1Exp', #'SeqOpt1Exp'{bool1=true,int1=15,
+ seq1=#'SeqIn'{boolIn=true,
+ intIn=66}}),
+ roundtrip('SeqOpt1Exp', #'SeqOpt1Exp'{bool1=asn1_NOVALUE,
+ int1=15,seq1=asn1_NOVALUE}),
+ roundtrip('SeqOpt2Exp', #'SeqOpt2Exp'{seq2=#'SeqIn'{boolIn=true,intIn=66},
+ bool2=true,int2=15}),
+ roundtrip('SeqOpt2Exp', #'SeqOpt2Exp'{seq2=asn1_NOVALUE,
+ bool2=true,int2=15}),
+ roundtrip('SeqOpt3Exp', #'SeqOpt3Exp'{bool3=true,
+ seq3=#'SeqIn'{boolIn=true,intIn=66},
+ int3=15}),
+ roundtrip('SeqOpt3Exp', #'SeqOpt3Exp'{bool3=asn1_NOVALUE,
+ seq3=asn1_NOVALUE,int3=15}),
+ roundtrip('SeqChoOpt', #'SeqChoOpt'{int=15,cho={boolC,true}}),
+ roundtrip('SeqChoOpt', #'SeqChoOpt'{int=15,cho=asn1_NOVALUE}),
ok.
+
+roundtrip(Type, Value) ->
+ asn1_test_lib:roundtrip('SeqOptional', Type, Value).