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

« back to all changes in this revision

Viewing changes to lib/reltool/test/reltool_test_lib.hrl

  • 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 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
-include_lib("wx/include/wx.hrl").
 
20
 
 
21
-define(log(Format,Args), reltool_test_lib:log(Format,Args,?FILE,?LINE)).
 
22
-define(warning(Format,Args), ?log("<WARNING>\n " ++ Format,Args)).
 
23
-define(error(Format,Args), reltool_test_lib:error(Format,Args,?FILE,?LINE)).
 
24
-define(verbose(Format,Args), reltool_test_lib:verbose(Format,Args,?FILE,?LINE)).
 
25
 
 
26
-define(fatal(Format,Args),
 
27
        ?error(Format, Args),
 
28
        exit({test_case_fatal, Format, Args, ?FILE, ?LINE})).
 
29
 
 
30
-define(skip(Format,Args),
 
31
        ?warning(Format, Args),
 
32
        exit({skipped, ?flat_format(Format, Args)})).
 
33
 
 
34
-define(ignore(Expr),
 
35
        fun() ->
 
36
                AcTuAlReS = (catch (Expr)),
 
37
                ?verbose("ok: ~p\n",[AcTuAlReS]),
 
38
                AcTuAlReS
 
39
        end()).
 
40
 
 
41
-define(msym(ExpectedRes, Expr),
 
42
        fun() ->
 
43
                AcTuAlReS = (catch (Expr)),
 
44
                case AcTuAlReS of
 
45
                    ExpectedRes ->
 
46
                        ?verbose("ok: ~p\n",[AcTuAlReS]),
 
47
                        AcTuAlReS;
 
48
                    _ ->
 
49
                        reltool_test_lib:error("Not matching actual result was:\n ~p \nExpected ~s\n",
 
50
                                               [AcTuAlReS, ??ExpectedRes], 
 
51
                                               ?FILE, ?LINE),
 
52
                        AcTuAlReS
 
53
                end
 
54
        end()).
 
55
 
 
56
-define(m(ExpectedRes, Expr),
 
57
        fun() ->
 
58
                AcTuAlReS = (catch (Expr)),
 
59
                case AcTuAlReS of
 
60
                    ExpectedRes ->
 
61
                        ?verbose("ok: ~p\n",[AcTuAlReS]),
 
62
                        AcTuAlReS;
 
63
                    _ ->
 
64
                        reltool_test_lib:error("Not matching actual result was:\n\t~p \nExpected:\n\t~p\n",
 
65
                                               [AcTuAlReS, ExpectedRes], 
 
66
                                               ?FILE, ?LINE),
 
67
                        AcTuAlReS
 
68
                end
 
69
        end()).
 
70
 
 
71
-define(m_receive(ExpectedMsg),
 
72
        ?m(ExpectedMsg,reltool_test_lib:pick_msg())).
 
73
 
 
74
-define(m_multi_receive(ExpectedMsgs),
 
75
        fun() ->
 
76
                TmPeXpCtEdMsGs = lists:sort(ExpectedMsgs),              
 
77
                AcTuAlReS = 
 
78
                    lists:sort(lists:map(fun(_) ->
 
79
                                                 reltool_test_lib:pick_msg()
 
80
                                         end, TmPeXpCtEdMsGs)),
 
81
                case AcTuAlReS of
 
82
                    TmPeXpCtEdMsGs ->
 
83
                        ?verbose("ok: ~p\n",[AcTuAlReS]),
 
84
                        AcTuAlReS;
 
85
                    _ ->
 
86
                        reltool_test_lib:error("Not matching actual result was:\n ~p \nExpected ~p\n",
 
87
                                               [AcTuAlReS, ExpectedMsgs], 
 
88
                                               ?FILE, ?LINE),
 
89
                        AcTuAlReS
 
90
                end
 
91
        end()).