4
%% Copyright Ericsson AB 1999-2009. All Rights Reserved.
6
%% The contents of this file are subject to the Erlang Public License,
7
%% Version 1.1, (the "License"); you may not use this file except in
8
%% compliance with the License. You should have received a copy of the
9
%% Erlang Public License along with this software. If not, it can be
10
%% retrieved online at http://www.erlang.org/.
12
%% Software distributed under the License is distributed on an "AS IS"
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
%% the License for the specific language governing rights and limitations
20
-module(testChoOptionalImplicitTag).
24
-export([optional/1]).
26
%-include("ChoOptional.hrl").
27
-include("test_server.hrl").
28
-include("External.hrl").
31
-record('Seq1',{bool, int = asn1_NOVALUE, cho = asn1_NOVALUE}).
32
-record('Seq2',{int = asn1_NOVALUE, cho = asn1_NOVALUE, bool}).
33
-record('Seq3',{cho = asn1_NOVALUE, int = asn1_NOVALUE, bool}).
36
compile(Config,Rules) ->
38
?line DataDir = ?config(data_dir,Config),
39
?line OutDir = ?config(priv_dir,Config),
40
?line true = code:add_patha(?config(priv_dir,Config)),
41
?line ok = asn1ct:compile(DataDir ++ "ChoOptionalImplicitTag",[Rules,{outdir,OutDir}]).
47
?line {ok,Bytes11} = asn1_wrapper:encode('ChoOptionalImplicitTag','Seq1',#'Seq1'{bool = true}),
48
?line {ok,{'Seq1',true,asn1_NOVALUE,asn1_NOVALUE}} =
49
asn1_wrapper:decode('ChoOptionalImplicitTag','Seq1',lists:flatten(Bytes11)),
51
?line {ok,Bytes12} = asn1_wrapper:encode('ChoOptionalImplicitTag','Seq1',#'Seq1'{bool = true,
53
?line {ok,{'Seq1',true,233,asn1_NOVALUE}} =
54
asn1_wrapper:decode('ChoOptionalImplicitTag','Seq1',lists:flatten(Bytes12)),
56
?line {ok,Bytes13} = asn1_wrapper:encode('ChoOptionalImplicitTag','Seq1',#'Seq1'{bool = true,
57
cho = {vsCho,"Vs Str"}}),
58
?line {ok,{'Seq1',true,asn1_NOVALUE,{vsCho,"Vs Str"}}} =
59
asn1_wrapper:decode('ChoOptionalImplicitTag','Seq1',lists:flatten(Bytes13)),
62
asn1_wrapper:encode('ChoOptionalImplicitTag','Seq1',#'Seq1'{bool = true,
63
cho = {ocStrCho,"Oct Str"}}),
64
?line {ok,{'Seq1',true,asn1_NOVALUE,{ocStrCho,"Oct Str"}}} =
65
asn1_wrapper:decode('ChoOptionalImplicitTag','Seq1',lists:flatten(Bytes14)),
69
?line {ok,Bytes21} = asn1_wrapper:encode('ChoOptionalImplicitTag','Seq2',#'Seq2'{bool = true}),
70
?line {ok,{'Seq2',asn1_NOVALUE,asn1_NOVALUE,true}} =
71
asn1_wrapper:decode('ChoOptionalImplicitTag','Seq2',lists:flatten(Bytes21)),
73
?line {ok,Bytes22} = asn1_wrapper:encode('ChoOptionalImplicitTag','Seq2',#'Seq2'{bool = true,
75
?line {ok,{'Seq2',233,asn1_NOVALUE,true}} =
76
asn1_wrapper:decode('ChoOptionalImplicitTag','Seq2',lists:flatten(Bytes22)),
78
?line {ok,Bytes23} = asn1_wrapper:encode('ChoOptionalImplicitTag','Seq2',#'Seq2'{bool = true,
79
cho = {vsCho,"Vs Str"}}),
80
?line {ok,{'Seq2',asn1_NOVALUE,{vsCho,"Vs Str"},true}} =
81
asn1_wrapper:decode('ChoOptionalImplicitTag','Seq2',lists:flatten(Bytes23)),
84
asn1_wrapper:encode('ChoOptionalImplicitTag','Seq2',#'Seq2'{bool = true,
85
cho = {ocStrCho,"Oct Str"}}),
86
?line {ok,{'Seq2',asn1_NOVALUE,{ocStrCho,"Oct Str"},true}} =
87
asn1_wrapper:decode('ChoOptionalImplicitTag','Seq2',lists:flatten(Bytes24)),
91
?line {ok,Bytes31} = asn1_wrapper:encode('ChoOptionalImplicitTag','Seq3',#'Seq3'{bool = true}),
92
?line {ok,{'Seq3',asn1_NOVALUE,asn1_NOVALUE,true}} =
93
asn1_wrapper:decode('ChoOptionalImplicitTag','Seq3',lists:flatten(Bytes31)),
95
?line {ok,Bytes32} = asn1_wrapper:encode('ChoOptionalImplicitTag','Seq3',#'Seq3'{bool = true,
97
?line {ok,{'Seq3',asn1_NOVALUE,233,true}} =
98
asn1_wrapper:decode('ChoOptionalImplicitTag','Seq3',lists:flatten(Bytes32)),
100
?line {ok,Bytes33} = asn1_wrapper:encode('ChoOptionalImplicitTag','Seq3',#'Seq3'{bool = true,
101
cho = {vsCho,"Vs Str"}}),
102
?line {ok,{'Seq3',{vsCho,"Vs Str"},asn1_NOVALUE,true}} =
103
asn1_wrapper:decode('ChoOptionalImplicitTag','Seq3',lists:flatten(Bytes33)),
106
asn1_wrapper:encode('ChoOptionalImplicitTag','Seq3',#'Seq3'{bool = true,
107
cho = {ocStrCho,"Oct Str"}}),
108
?line {ok,{'Seq3',{ocStrCho,"Oct Str"},asn1_NOVALUE,true}} =
109
asn1_wrapper:decode('ChoOptionalImplicitTag','Seq3',lists:flatten(Bytes34)),