Permalink
Browse files

Statem-related bugfixes: Make eval/2 work (type mismatch); return non…

…-symbolic state from run_commands.
  • Loading branch information...
1 parent 5c5e5eb commit 3e96d90dc6d608ada1781d195792d4f3b8b24843 @esstrifork esstrifork committed Sep 8, 2011
Showing with 5 additions and 3 deletions.
  1. +3 −1 src/triq_dom.erl
  2. +2 −2 src/triq_statem.erl
View
@@ -827,6 +827,8 @@ bound_shrink(#?DOM{kind=#bound_domain{dom1=Dom1,val1=Val1,dom2=Dom2,fun2=Fun,siz
%% @doc support function for `?LETSHRINK([X,...],[domain(),...],domain())'
%% @private
+bindshrink(Dom,_Fun) when not is_list(Dom) ->
+ error(argument_to_LETSHRINK_macro_must_be_lists);
bindshrink(Dom,Fun) when is_function(Fun,1) ->
domain(letshrink,
fun(_,SampleSize) ->
@@ -1244,7 +1246,7 @@ eval(PropList, Tuple) when is_tuple(Tuple) ->
A = eval(PropList, Args),
erlang:apply(M,F,A);
- [var, Name] when is_atom(Name) ->
+ [var, Name] when is_integer(Name) ->
case proplists:lookup(Name, PropList) of
none -> {var, Name};
{Name, Value} -> Value
View
@@ -130,7 +130,7 @@ run_commands(Module,Commands,Env) ->
do_run_command(Commands, Env, Module, History, State) ->
case Commands of
[] ->
- {History, State, ok};
+ {History, eval(Env,State), ok};
[{init,S}|Rest] ->
State2 = eval(Env, S),
@@ -153,7 +153,7 @@ do_run_command(Commands, Env, Module, History, State) ->
do_run_command(Rest, Env2, Module, History2, State2);
Other ->
- {History, State, {postcondition, Other}}
+ {History, eval(Env,State), {postcondition, Other}}
end
end.

0 comments on commit 3e96d90

Please sign in to comment.