~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%%
 
2
%% %CopyrightBegin%
 
3
%%
 
4
%% Copyright Ericsson AB 1997-2010. 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(testSetTypeRefSet).
 
21
 
 
22
-export([compile/3]).
 
23
-export([main/1]).
 
24
 
 
25
-include_lib("test_server/include/test_server.hrl").
 
26
 
 
27
-record('Set1',{bool1, int1, set1}).
 
28
-record('Set2',{set2, bool2, int2}).
 
29
-record('Set3',{bool3, set3, int3}).
 
30
-record('Set4',{set41, set42, set43}).
 
31
-record('SetIn',{boolIn, intIn}).
 
32
-record('SetS1',{boolS1, intS1, setS1}).
 
33
-record('SetS1_setS1',{boolIn, intIn}).
 
34
-record('SetS2',{setS2, boolS2, intS2}).
 
35
-record('SetS2_setS2',{boolIn, intIn}).
 
36
-record('SetS3',{boolS3, setS3, intS3}).
 
37
-record('SetS3_setS3',{boolIn, intIn}).
 
38
-record('SetSTag',{setS1, setS2, setS3}).
 
39
-record('SetSTag_setS1',{b1, i1}).
 
40
-record('SetSTag_setS2',{b2, i2}).
 
41
-record('SetSTag_setS3',{b3, i3}).
 
42
-record('SetTRset',{setSet, setSetI, setSetE, 'setSet-I', 'setSetI-I', 'setSetE-I', 'setSet-E', 'setSetI-E', 'setSetE-E'}).
 
43
-record('SetSet',{setInt, setOs}).
 
44
-record('SetSetImp',{setInt, setOs}).
 
45
-record('SetSetExp',{setInt, setOs}).
 
46
 
 
47
 
 
48
 
 
49
compile(Config,Rules,Options) ->
 
50
 
 
51
    ?line DataDir = ?config(data_dir,Config),
 
52
    ?line OutDir = ?config(priv_dir,Config),
 
53
    ?line true = code:add_patha(?config(priv_dir,Config)),
 
54
    ?line ok = asn1ct:compile(DataDir ++ "SetTypeRefSet",[Rules,{outdir,OutDir}]++Options).
 
55
 
 
56
 
 
57
 
 
58
main(_Rules) ->
 
59
    
 
60
    
 
61
    ?line {ok,Bytes11} = 
 
62
        asn1_wrapper:encode('SetTypeRefSet','Set1',#'Set1'{bool1 = true,
 
63
                                                     int1 = 15,
 
64
                                                     set1 = #'SetIn'{boolIn = true,
 
65
                                                                     intIn = 66}}), 
 
66
    ?line {ok,{'Set1',true,15,{'SetIn',true,66}}} = 
 
67
        asn1_wrapper:decode('SetTypeRefSet','Set1',lists:flatten(Bytes11)),
 
68
    
 
69
    
 
70
    
 
71
    ?line {ok,Bytes12} = 
 
72
        asn1_wrapper:encode('SetTypeRefSet','Set2',#'Set2'{set2 = #'SetIn'{boolIn = true,
 
73
                                                                     intIn = 66},
 
74
                                                     bool2 = true,
 
75
                                                     int2 = 15}),    
 
76
    ?line {ok,{'Set2',{'SetIn',true,66},true,15}} = 
 
77
        asn1_wrapper:decode('SetTypeRefSet','Set2',lists:flatten(Bytes12)),
 
78
    
 
79
    
 
80
    ?line {ok,Bytes13} = 
 
81
        asn1_wrapper:encode('SetTypeRefSet','Set3',#'Set3'{bool3 = true,
 
82
                                                     set3 = #'SetIn'{boolIn = true,
 
83
                                                                     intIn = 66},
 
84
                                                     int3 = 15}),    
 
85
    ?line {ok,{'Set3',true,{'SetIn',true,66},15}} = 
 
86
        asn1_wrapper:decode('SetTypeRefSet','Set3',lists:flatten(Bytes13)),
 
87
    
 
88
    
 
89
    
 
90
    ?line {ok,Bytes14} = 
 
91
        asn1_wrapper:encode('SetTypeRefSet','Set4',#'Set4'{set41 = #'SetIn'{boolIn = true,
 
92
                                                                      intIn = 66},
 
93
                                                     set42 = #'SetIn'{boolIn = true,
 
94
                                                                      intIn = 66},
 
95
                                                     set43 = #'SetIn'{boolIn = true,
 
96
                                                                      intIn = 66}}),    
 
97
    ?line {ok,{'Set4',{'SetIn',true,66},{'SetIn',true,66},{'SetIn',true,66}}} = 
 
98
        asn1_wrapper:decode('SetTypeRefSet','Set4',lists:flatten(Bytes14)),
 
99
    
 
100
    
 
101
    
 
102
    
 
103
    
 
104
    
 
105
    
 
106
    
 
107
    ?line {ok,Bytes21} = 
 
108
        asn1_wrapper:encode('SetTypeRefSet','SetS1',#'SetS1'{boolS1 = true,
 
109
                                                       intS1 = 15,
 
110
                                                       setS1 = #'SetS1_setS1'{boolIn = true,
 
111
                                                                              intIn = 66}}), 
 
112
    ?line {ok,{'SetS1',true,15,{'SetS1_setS1',true,66}}} = 
 
113
        asn1_wrapper:decode('SetTypeRefSet','SetS1',lists:flatten(Bytes21)),
 
114
    
 
115
    
 
116
    ?line {ok,Bytes22} = 
 
117
        asn1_wrapper:encode('SetTypeRefSet','SetS2',#'SetS2'{setS2 = #'SetS2_setS2'{boolIn = true,
 
118
                                                                              intIn = 66},
 
119
                                                       boolS2 = true,
 
120
                                                       intS2 = 15}),    
 
121
    ?line {ok,{'SetS2',{'SetS2_setS2',true,66},true,15}} = 
 
122
        asn1_wrapper:decode('SetTypeRefSet','SetS2',lists:flatten(Bytes22)),
 
123
    
 
124
    
 
125
    
 
126
    ?line {ok,Bytes23} = 
 
127
        asn1_wrapper:encode('SetTypeRefSet','SetS3',#'SetS3'{boolS3 = true,
 
128
                                                       setS3 = #'SetS3_setS3'{boolIn = true,
 
129
                                                                              intIn = 66},
 
130
                                                       intS3 = 15}),    
 
131
    ?line {ok,{'SetS3',true,{'SetS3_setS3',true,66},15}} = 
 
132
        asn1_wrapper:decode('SetTypeRefSet','SetS3',lists:flatten(Bytes23)),
 
133
    
 
134
    
 
135
    
 
136
    
 
137
    
 
138
    
 
139
    ?line {ok,Bytes31} = 
 
140
        asn1_wrapper:encode('SetTypeRefSet','SetSTag',#'SetSTag'{setS1 = #'SetSTag_setS1'{b1 = true,
 
141
                                                                                    i1 = 11},
 
142
                                                           setS2 = #'SetSTag_setS2'{b2 = true,
 
143
                                                                                    i2 = 22},
 
144
                                                           setS3 = #'SetSTag_setS3'{b3 = true,
 
145
                                                                                    i3 = 33}}),    
 
146
    ?line {ok,{'SetSTag',{'SetSTag_setS1',true,11},
 
147
               {'SetSTag_setS2',true,22},
 
148
               {'SetSTag_setS3',true,33}}} = 
 
149
        asn1_wrapper:decode('SetTypeRefSet','SetSTag',lists:flatten(Bytes31)),
 
150
    
 
151
    
 
152
    
 
153
    
 
154
    
 
155
    ?line {ok,Bytes41} = 
 
156
        asn1_wrapper:encode('SetTypeRefSet','SetTRset',
 
157
                      #'SetTRset'{'setSet' = #'SetSet'{setOs = "A1",
 
158
                                                       setInt = 2},
 
159
                                  'setSetI' = #'SetSet'{setOs = "A2",
 
160
                                                        setInt = 2},
 
161
                                  'setSetE' = #'SetSet'{setOs = "A3",
 
162
                                                        setInt = 2},
 
163
                                  'setSet-I' = #'SetSetImp'{setOs = "A4",
 
164
                                                            setInt = 2},
 
165
                                  'setSetI-I' = #'SetSetImp'{setOs = "A5",
 
166
                                                             setInt = 2},
 
167
                                  'setSetE-I' = #'SetSetImp'{setOs = "A6",
 
168
                                                             setInt = 2},
 
169
                                  'setSet-E' = #'SetSetExp'{setOs = "A7",
 
170
                                                            setInt = 2},
 
171
                                  'setSetI-E' = #'SetSetExp'{setOs = "A8",
 
172
                                                             setInt = 2},
 
173
                                  'setSetE-E' = #'SetSetExp'{setOs = "A9",
 
174
                                                             setInt = 2}}),
 
175
    ?line {ok,{'SetTRset',{'SetSet',2,"A1"},
 
176
      {'SetSet',2,"A2"},
 
177
      {'SetSet',2,"A3"},
 
178
      {'SetSetImp',2,"A4"},
 
179
      {'SetSetImp',2,"A5"},
 
180
      {'SetSetImp',2,"A6"},
 
181
      {'SetSetExp',2,"A7"},
 
182
      {'SetSetExp',2,"A8"},
 
183
      {'SetSetExp',2,"A9"}}} = 
 
184
        asn1_wrapper:decode('SetTypeRefSet','SetTRset',lists:flatten(Bytes41)),
 
185
    
 
186
    ok.