Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6990b3d

Browse files
committed
Add eunit timeouts.
1 parentc464512 commit6990b3d

File tree

4 files changed

+85
-30
lines changed

4 files changed

+85
-30
lines changed

‎src/pqueue.erl‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
%%%
1414
%%% MIT License
1515
%%%
16-
%%% Copyright (c) 2011-2017 Michael Truog <mjtruog at protonmail dot com>
16+
%%% Copyright (c) 2011-2020 Michael Truog <mjtruog at protonmail dot com>
1717
%%%
1818
%%% Permission is hereby granted, free of charge, to any person obtaining a
1919
%%% copy of this software and associated documentation files (the "Software"),
@@ -34,8 +34,8 @@
3434
%%% DEALINGS IN THE SOFTWARE.
3535
%%%
3636
%%% @author Michael Truog <mjtruog at protonmail dot com>
37-
%%% @copyright 2011-2017 Michael Truog
38-
%%% @version1.7.1 {@date} {@time}
37+
%%% @copyright 2011-2020 Michael Truog
38+
%%% @version2.0.1 {@date} {@time}
3939
%%%------------------------------------------------------------------------
4040

4141
-module(pqueue).
@@ -2230,15 +2230,17 @@ out_specific(20,
22302230
-ifdef(TEST).
22312231
-include_lib("eunit/include/eunit.hrl").
22322232

2233-
internal_test_()->
2234-
[
2235-
{"internal tests",?_assertEqual(ok,test())}
2236-
].
2233+
-include("pqueue_test.hrl").
22372234

2238-
proper_test_()->
2239-
{timeout,600, [
2240-
{"proper tests",?_assert(pqueue_proper:qc_pq())}
2235+
module_test_()->
2236+
{timeout,?TEST_TIMEOUT, [
2237+
{"internal tests",?_assertOk(test())}
22412238
]}.
22422239

2240+
long_test_()->
2241+
test_condition([
2242+
{"proper tests",?_assert(pqueue_proper:qc_pq())}
2243+
],?CLOUDI_LONG_TEST_TIMEOUT).
2244+
22432245
-endif.
22442246

‎src/pqueue2.erl‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
%%%
1212
%%% MIT License
1313
%%%
14-
%%% Copyright (c) 2011-2017 Michael Truog <mjtruog at protonmail dot com>
14+
%%% Copyright (c) 2011-2020 Michael Truog <mjtruog at protonmail dot com>
1515
%%%
1616
%%% Permission is hereby granted, free of charge, to any person obtaining a
1717
%%% copy of this software and associated documentation files (the "Software"),
@@ -32,8 +32,8 @@
3232
%%% DEALINGS IN THE SOFTWARE.
3333
%%%
3434
%%% @author Michael Truog <mjtruog at protonmail dot com>
35-
%%% @copyright 2011-2017 Michael Truog
36-
%%% @version1.7.1 {@date} {@time}
35+
%%% @copyright 2011-2020 Michael Truog
36+
%%% @version2.0.1 {@date} {@time}
3737
%%%------------------------------------------------------------------------
3838

3939
-module(pqueue2).
@@ -467,15 +467,17 @@ merge({P, HL1, HR1, element, Value}, {P, HL2, HR2, queue, Queue}) ->
467467
-ifdef(TEST).
468468
-include_lib("eunit/include/eunit.hrl").
469469

470-
internal_test_()->
471-
[
472-
{"internal tests",?_assertEqual(ok,test())}
473-
].
470+
-include("pqueue_test.hrl").
474471

475-
proper_test_()->
476-
{timeout,600, [
477-
{"proper tests",?_assert(pqueue_proper:qc_pq2())}
472+
module_test_()->
473+
{timeout,?TEST_TIMEOUT, [
474+
{"internal tests",?_assertOk(test())}
478475
]}.
479476

477+
long_test_()->
478+
test_condition([
479+
{"proper tests",?_assert(pqueue_proper:qc_pq2())}
480+
],?CLOUDI_LONG_TEST_TIMEOUT).
481+
480482
-endif.
481483

‎src/pqueue4.erl‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
%%%
1414
%%% MIT License
1515
%%%
16-
%%% Copyright (c) 2011-2017 Michael Truog <mjtruog at protonmail dot com>
16+
%%% Copyright (c) 2011-2020 Michael Truog <mjtruog at protonmail dot com>
1717
%%%
1818
%%% Permission is hereby granted, free of charge, to any person obtaining a
1919
%%% copy of this software and associated documentation files (the "Software"),
@@ -52,8 +52,8 @@
5252
%%% limitations under the License.
5353
%%%
5454
%%% @author Michael Truog <mjtruog at protonmail dot com>
55-
%%% @copyright 2011-2017 Michael Truog
56-
%%% @version1.7.1 {@date} {@time}
55+
%%% @copyright 2011-2020 Michael Truog
56+
%%% @version2.0.1 {@date} {@time}
5757
%%%------------------------------------------------------------------------
5858

5959
-module(pqueue4).
@@ -11573,16 +11573,18 @@ remove_unique_p(0, F,
1157311573
-ifdef(TEST).
1157411574
-include_lib("eunit/include/eunit.hrl").
1157511575

11576-
internal_test_() ->
11577-
[
11578-
{"internal tests",?_assertEqual(ok,test())}
11579-
].
11576+
-include("pqueue_test.hrl").
1158011577

11581-
proper_test_()->
11582-
{timeout,600, [
11583-
{"proper tests",?_assert(pqueue_proper:qc_pq4())}
11578+
module_test_() ->
11579+
{timeout,?TEST_TIMEOUT, [
11580+
{"internal tests",?_assertOk(test())}
1158411581
]}.
1158511582

11583+
long_test_()->
11584+
test_condition([
11585+
{"proper tests",?_assert(pqueue_proper:qc_pq4())}
11586+
],?CLOUDI_LONG_TEST_TIMEOUT).
11587+
1158611588
-endif.
1158711589

1158811590
%%-------------------------------------------------------------------------

‎src/pqueue_test.hrl‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
%-*-Mode:erlang;coding:utf-8;tab-width:4;c-basic-offset:4;indent-tabs-mode:()-*-
2+
% ex: set ft=erlang fenc=utf-8 sts=4 ts=4 sw=4 et nomod:
3+
%%%
4+
%%%------------------------------------------------------------------------
5+
%%% pqueue eunit common functionality
6+
%%%
7+
%%% MIT License
8+
%%%
9+
%%% Copyright (c) 2020 Michael Truog <mjtruog at protonmail dot com>
10+
%%%
11+
%%% Permission is hereby granted, free of charge, to any person obtaining a
12+
%%% copy of this software and associated documentation files (the "Software"),
13+
%%% to deal in the Software without restriction, including without limitation
14+
%%% the rights to use, copy, modify, merge, publish, distribute, sublicense,
15+
%%% and/or sell copies of the Software, and to permit persons to whom the
16+
%%% Software is furnished to do so, subject to the following conditions:
17+
%%%
18+
%%% The above copyright notice and this permission notice shall be included in
19+
%%% all copies or substantial portions of the Software.
20+
%%%
21+
%%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22+
%%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23+
%%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24+
%%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25+
%%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26+
%%% FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27+
%%% DEALINGS IN THE SOFTWARE.
28+
%%%
29+
%%%------------------------------------------------------------------------
30+
31+
-ifndef(_assertOk).
32+
-define(_assertOk(Expr),?_assertEqual(ok,Expr)).
33+
-endif.
34+
35+
-ifdef(CLOUDI_TEST_TIMEOUT).
36+
-define(TEST_TIMEOUT,?CLOUDI_TEST_TIMEOUT).% seconds
37+
-else.
38+
-define(TEST_TIMEOUT,10).% seconds
39+
-endif.
40+
-ifndef(CLOUDI_LONG_TEST_TIMEOUT).
41+
-define(CLOUDI_LONG_TEST_TIMEOUT,60).% minutes
42+
-endif.
43+
44+
test_condition(_,0)->
45+
[];
46+
test_condition(L,LongTestTimeout)
47+
whenLongTestTimeout>0->
48+
{timeout,LongTestTimeout*60,L}.
49+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp