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

« back to all changes in this revision

Viewing changes to lib/asn1/test/testOpt.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(testOpt).
 
21
 
 
22
-export([compile/2]).
 
23
-export([main/1]).
 
24
 
 
25
-include_lib("test_server/include/test_server.hrl").
 
26
 
 
27
-record('Opt1',{bool0, 
 
28
                bool1 = asn1_NOVALUE, 
 
29
                bool2 = asn1_NOVALUE, 
 
30
                bool3 = asn1_NOVALUE}).
 
31
 
 
32
-record('Opt2',{bool10, 
 
33
                bool11 = asn1_NOVALUE, 
 
34
                bool12 = asn1_NOVALUE, 
 
35
                bool13}).
 
36
 
 
37
-record('Opt3',{bool30 = asn1_NOVALUE, 
 
38
                bool31 = asn1_NOVALUE, 
 
39
                bool32 = asn1_NOVALUE, 
 
40
                bool33 = asn1_NOVALUE}).
 
41
 
 
42
 
 
43
compile(Config,Rules) ->
 
44
 
 
45
    ?line DataDir = ?config(data_dir,Config),
 
46
    ?line OutDir = ?config(priv_dir,Config),
 
47
    ?line true = code:add_patha(?config(priv_dir,Config)),
 
48
    ?line ok = asn1ct:compile(DataDir ++ "Opt",[Rules,{outdir,OutDir}]).
 
49
 
 
50
 
 
51
 
 
52
main(_Rules) ->
 
53
    
 
54
    ?line {ok,Bytes11} = asn1_wrapper:encode('Opt','Opt1',#'Opt1'{bool0 = true,
 
55
                                                         bool1 = true,
 
56
                                                         bool2 = true,
 
57
                                                         bool3 = true}),    
 
58
    ?line {ok,{'Opt1',true,true,true,true}} = 
 
59
        asn1_wrapper:decode('Opt','Opt1',lists:flatten(Bytes11)),
 
60
 
 
61
    ?line {ok,Bytes12} = asn1_wrapper:encode('Opt','Opt1',#'Opt1'{bool0 = true}),
 
62
    ?line {ok,{'Opt1',true,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}} = 
 
63
        asn1_wrapper:decode('Opt','Opt1',lists:flatten(Bytes12)),
 
64
    
 
65
    ?line {ok,Bytes13} = asn1_wrapper:encode('Opt','Opt1',#'Opt1'{bool0 = true,
 
66
                                                         bool2 = false}),
 
67
    ?line {ok,{'Opt1',true,asn1_NOVALUE,false,asn1_NOVALUE}} = 
 
68
        asn1_wrapper:decode('Opt','Opt1',lists:flatten(Bytes13)),
 
69
    
 
70
    ?line {ok,Bytes14} = asn1_wrapper:encode('Opt','Opt1',#'Opt1'{bool0 = false,
 
71
                                                          bool3 = false}),
 
72
    ?line {ok,{'Opt1',false,asn1_NOVALUE,asn1_NOVALUE,false}} = 
 
73
        asn1_wrapper:decode('Opt','Opt1',lists:flatten(Bytes14)),
 
74
    
 
75
    
 
76
    
 
77
    
 
78
    ?line {ok,Bytes21} = asn1_wrapper:encode('Opt','Opt2',#'Opt2'{bool10 = false,
 
79
                                                          bool11 = false,
 
80
                                                          bool12 = false,
 
81
                                                          bool13 = false}),
 
82
    ?line {ok,{'Opt2',false,false,false,false}} = 
 
83
        asn1_wrapper:decode('Opt','Opt2',lists:flatten(Bytes21)),
 
84
    
 
85
    ?line {ok,Bytes22} = asn1_wrapper:encode('Opt','Opt2',#'Opt2'{bool10 = true,
 
86
                                                          bool13 = false}),
 
87
    ?line {ok,{'Opt2',true,asn1_NOVALUE,asn1_NOVALUE,false}} = 
 
88
        asn1_wrapper:decode('Opt','Opt2',lists:flatten(Bytes22)),
 
89
    
 
90
    ?line {ok,Bytes23} = asn1_wrapper:encode('Opt','Opt2',#'Opt2'{bool10 = true,
 
91
                                                          bool11 = false,
 
92
                                                          bool13 = false}),
 
93
    ?line {ok,{'Opt2',true,false,asn1_NOVALUE,false}} = 
 
94
        asn1_wrapper:decode('Opt','Opt2',lists:flatten(Bytes23)),
 
95
    
 
96
    ?line {ok,Bytes24} = asn1_wrapper:encode('Opt','Opt2',#'Opt2'{bool10 = false,
 
97
                                                          bool12 = false,
 
98
                                                          bool13 = false}),
 
99
    ?line {ok,{'Opt2',false,asn1_NOVALUE,false,false}} = 
 
100
        asn1_wrapper:decode('Opt','Opt2',lists:flatten(Bytes24)),
 
101
    
 
102
    
 
103
    
 
104
    
 
105
    ?line {ok,Bytes31} = asn1_wrapper:encode('Opt','Opt3',#'Opt3'{bool30 = false,
 
106
                                                          bool31 = false,
 
107
                                                          bool32 = false,
 
108
                                                          bool33 = false}),
 
109
    ?line {ok,{'Opt3',false,false,false,false}} = 
 
110
        asn1_wrapper:decode('Opt','Opt3',lists:flatten(Bytes31)),
 
111
    
 
112
    ?line {ok,Bytes32} = asn1_wrapper:encode('Opt','Opt3',#'Opt3'{}),
 
113
    ?line {ok,{'Opt3',asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}} = 
 
114
        asn1_wrapper:decode('Opt','Opt3',lists:flatten(Bytes32)),
 
115
    
 
116
    ?line {ok,Bytes33} = asn1_wrapper:encode('Opt','Opt3',#'Opt3'{bool30 = true}),
 
117
    ?line {ok,{'Opt3',true,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}} = 
 
118
        asn1_wrapper:decode('Opt','Opt3',lists:flatten(Bytes33)),
 
119
    
 
120
    ?line {ok,Bytes34} = asn1_wrapper:encode('Opt','Opt3',#'Opt3'{bool32 = false}),
 
121
    ?line {ok,{'Opt3',asn1_NOVALUE,asn1_NOVALUE,false,asn1_NOVALUE}} = 
 
122
        asn1_wrapper:decode('Opt','Opt3',lists:flatten(Bytes34)),
 
123
    
 
124
    ?line {ok,Bytes35} = asn1_wrapper:encode('Opt','Opt3',#'Opt3'{bool33 = false}),
 
125
    ?line {ok,{'Opt3',asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,false}} = 
 
126
        asn1_wrapper:decode('Opt','Opt3',lists:flatten(Bytes35)),
 
127
    
 
128
    
 
129
    
 
130
    ok.