1%%% Copyright 2010-2013 Manolis Papadakis <manopapad@gmail.com>, 2%%% Eirini Arvaniti <eirinibob@gmail.com> 3%%% and Kostis Sagonas <kostis@cs.ntua.gr> 4%%% 5%%% This file is part of PropEr. 6%%% 7%%% PropEr is free software: you can redistribute it and/or modify 8%%% it under the terms of the GNU General Public License as published by 9%%% the Free Software Foundation, either version 3 of the License, or 10%%% (at your option) any later version. 11%%% 12%%% PropEr is distributed in the hope that it will be useful, 13%%% but WITHOUT ANY WARRANTY; without even the implied warranty of 14%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15%%% GNU General Public License for more details. 16%%% 17%%% You should have received a copy of the GNU General Public License 18%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>. 19 20%%% @copyright 2010-2013 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas 21%%% @version {@version} 22%%% @author Manolis Papadakis 23%%% @doc Common parts of user and internal header files 24 25 26%%------------------------------------------------------------------------------ 27%% Test generation macros 28%%------------------------------------------------------------------------------ 29 30-define(FORALL(X,RawType,Prop), proper:forall(RawType,fun(X) -> Prop end)). 31-define(IMPLIES(Pre,Prop), proper:implies(Pre,?DELAY(Prop))). 32-define(WHENFAIL(Action,Prop), proper:whenfail(?DELAY(Action),?DELAY(Prop))). 33-define(TRAPEXIT(Prop), proper:trapexit(?DELAY(Prop))). 34-define(TIMEOUT(Limit,Prop), proper:timeout(Limit,?DELAY(Prop))). 35%% TODO: -define(ALWAYS(Tests,Prop), proper:always(Tests,?DELAY(Prop))). 36%% TODO: -define(SOMETIMES(Tests,Prop), proper:sometimes(Tests,?DELAY(Prop))). 37 38 39%%------------------------------------------------------------------------------ 40%% Generator macros 41%%------------------------------------------------------------------------------ 42 43-define(FORCE(X), (X)()). 44-define(DELAY(X), fun() -> X end). 45-define(LAZY(X), proper_types:lazy(?DELAY(X))). 46-define(SIZED(SizeArg,Gen), proper_types:sized(fun(SizeArg) -> Gen end)). 47-define(LET(X,RawType,Gen), proper_types:bind(RawType,fun(X) -> Gen end,false)). 48-define(SHRINK(Gen,AltGens), 49 proper_types:shrinkwith(?DELAY(Gen),?DELAY(AltGens))). 50-define(LETSHRINK(Xs,RawType,Gen), 51 proper_types:bind(RawType,fun(Xs) -> Gen end,true)). 52-define(SUCHTHAT(X,RawType,Condition), 53 proper_types:add_constraint(RawType,fun(X) -> Condition end,true)). 54-define(SUCHTHATMAYBE(X,RawType,Condition), 55 proper_types:add_constraint(RawType,fun(X) -> Condition end,false)). 56