1%%% -*- coding: utf-8 -*- 2%%% -*- erlang-indent-level: 2 -*- 3%%% ------------------------------------------------------------------- 4%%% Copyright 2020- Manolis Papadakis <manopapad@gmail.com>, 5%%% Eirini Arvaniti <eirinibob@gmail.com> 6%%% and Kostis Sagonas <kostis@cs.ntua.gr> 7%%% 8%%% This file is part of PropEr. 9%%% 10%%% PropEr is free software: you can redistribute it and/or modify 11%%% it under the terms of the GNU General Public License as published by 12%%% the Free Software Foundation, either version 3 of the License, or 13%%% (at your option) any later version. 14%%% 15%%% PropEr is distributed in the hope that it will be useful, 16%%% but WITHOUT ANY WARRANTY; without even the implied warranty of 17%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18%%% GNU General Public License for more details. 19%%% 20%%% You should have received a copy of the GNU General Public License 21%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>. 22 23%%% @copyright 2020 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas 24%%% @version {@version} 25%%% @author Kostis Sagonas 26 27%% 28%% Contains some tests for function generators 29%% 30-module(fun_tests). 31 32-include_lib("proper/include/proper.hrl"). 33 34%%---------------------- 35%% Properties that pass 36%%---------------------- 37 38prop_fun_bool() -> 39 ?FORALL({F, X}, {function(1,boolean()), any()}, is_boolean(F(X))). 40 41%%----------------------------- 42%% Properties that should fail 43%%----------------------------- 44 45prop_fun_int_int() -> 46 ?FORALL({F, X}, {function([integer()],integer()), integer()}, F(X) < 42). 47 48prop_lists_map_filter() -> 49 ?FORALL({MapFun, FilterFun, List}, 50 {function([int()],any()), function([int()],bool()), list(int())}, 51 lists:map(MapFun, lists:filter(FilterFun, List)) =:= 52 lists:filter(FilterFun, lists:map(MapFun, List))). 53