~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/asn1/test/testChoOptionalImplicitTag.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2010-03-09 17:34:57 UTC
  • mfrom: (10.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100309173457-4yd6hlcb2osfhx31
Tags: 1:13.b.4-dfsg-3
Manpages in section 1 are needed even if only arch-dependent packages are
built. So, re-enabled them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%%
 
2
%% %CopyrightBegin%
 
3
%% 
 
4
%% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 
5
%% 
 
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/.
 
11
%% 
 
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
 
15
%% under the License.
 
16
%% 
 
17
%% %CopyrightEnd%
 
18
%%
 
19
%%
 
20
-module(testChoOptionalImplicitTag).
 
21
 
 
22
 
 
23
-export([compile/2]).
 
24
-export([optional/1]).
 
25
 
 
26
%-include("ChoOptional.hrl").
 
27
-include("test_server.hrl").
 
28
-include("External.hrl").
 
29
 
 
30
 
 
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}).
 
34
 
 
35
 
 
36
compile(Config,Rules) ->
 
37
 
 
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}]).
 
42
 
 
43
 
 
44
 
 
45
optional(_Rules) ->
 
46
    
 
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)),
 
50
    
 
51
    ?line {ok,Bytes12} = asn1_wrapper:encode('ChoOptionalImplicitTag','Seq1',#'Seq1'{bool = true,
 
52
                                                                    int = 233}),
 
53
    ?line {ok,{'Seq1',true,233,asn1_NOVALUE}} = 
 
54
        asn1_wrapper:decode('ChoOptionalImplicitTag','Seq1',lists:flatten(Bytes12)),
 
55
    
 
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)),
 
60
    
 
61
    ?line {ok,Bytes14} = 
 
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)),
 
66
    
 
67
    
 
68
    
 
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)),
 
72
    
 
73
    ?line {ok,Bytes22} = asn1_wrapper:encode('ChoOptionalImplicitTag','Seq2',#'Seq2'{bool = true,
 
74
                                                                    int = 233}),
 
75
    ?line {ok,{'Seq2',233,asn1_NOVALUE,true}} = 
 
76
        asn1_wrapper:decode('ChoOptionalImplicitTag','Seq2',lists:flatten(Bytes22)),
 
77
    
 
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)),
 
82
    
 
83
    ?line {ok,Bytes24} = 
 
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)),
 
88
    
 
89
    
 
90
    
 
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)),
 
94
    
 
95
    ?line {ok,Bytes32} = asn1_wrapper:encode('ChoOptionalImplicitTag','Seq3',#'Seq3'{bool = true,
 
96
                                                                    int = 233}),
 
97
    ?line {ok,{'Seq3',asn1_NOVALUE,233,true}} = 
 
98
        asn1_wrapper:decode('ChoOptionalImplicitTag','Seq3',lists:flatten(Bytes32)),
 
99
    
 
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)),
 
104
    
 
105
    ?line {ok,Bytes34} = 
 
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)),
 
110
    
 
111
    
 
112
    
 
113
    ok.