Permalink
Browse files

triq:shrink_loop(): Recurrence check failed if it was the first shrin…

…k attempt which returned its input.
  • Loading branch information...
1 parent 2d38bff commit c067e3f54233a29ff4e3309b7ac6331d1aee6204 Erik Søe Sørensen committed with Jan 4, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/triq.erl
View
8 src/triq.erl
@@ -332,7 +332,7 @@ check(Property, Counterexample, RunIters) ->
%% Run the shrinking function
%%
- Simp = shrink_loop(Fun,Input,InputDom,?SHRINK_COUNT,tl(Context),gb_sets:new()),
+ Simp = shrink_loop(Fun,Input,InputDom,?SHRINK_COUNT,tl(Context)),
%%
%% Compute the counter example
@@ -377,12 +377,16 @@ counterexample() ->
%%
shrink_deeper(Input,[{_,F1,I1,G1}|T]) ->
- [Input | shrink_loop(F1,I1,G1,?SHRINK_COUNT,T,gb_sets:new())];
+ [Input | shrink_loop(F1,I1,G1,?SHRINK_COUNT,T)];
shrink_deeper(Input,[]) -> [Input].
%% this is the main logic for the simplify function
+shrink_loop(Fun,Input,InputDom,GS,Context) ->
+ InitialTested = gb_sets:add(Input,gb_sets:new()),
+ shrink_loop(Fun,Input,InputDom,GS,Context, InitialTested).
+
shrink_loop(_,Input,_,0,Context,_) ->
shrink_deeper(Input,Context);

0 comments on commit c067e3f

Please sign in to comment.