|
| 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 | + |