Skip to content

Commit

Permalink
Record counter example
Browse files Browse the repository at this point in the history
  • Loading branch information
krestenkrab committed May 3, 2010
1 parent 4ee8e7b commit 3d6cfa9
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/triq.erl
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,18 @@ check(Property) ->
%%
Simp = simplify(Fun,Input,InputDom,1000,tl(Context)),

io:format("Simplified:~n"),
%%
%% Compute the counter example
%%
CounterExample = [{Syntax,Fun2,SimplifiedInput,Dom2} ||
{{Syntax,Fun2,_Input,Dom2}, SimplifiedInput}
<- lists:zip(Context,Simp)],

lists:foreach(fun({{Syntax,_,_,_},Val}) ->
io:format("\t~s = ~w~n", [Syntax,Val])
end,
lists:zip(Context,Simp)),
%% save the counter example
put('triq:counterexample', CounterExample),

io:format("Simplified:~n"),
print_counterexample(CounterExample),

Error;

Expand All @@ -231,6 +237,11 @@ check(Property) ->
end
.

print_counterexample(CounterExample) ->
lists:foreach(fun({Syntax,_Fun,Val,_Dom}) ->
io:format("\t~s = ~w~n", [Syntax,Val])
end,
CounterExample).

%%
%% when the property has nested ?FORALL statements,
Expand Down

0 comments on commit 3d6cfa9

Please sign in to comment.