Permalink
Browse files

Merge pull request #3 from eriksoe/master

Misc. Triq improvements, inclusing statem fixes.
  • Loading branch information...
2 parents 5612de7 + 3e96d90 commit d60828ab4b9ba5a2ca1a5d4f551e35311f8c0124 @krestenkrab committed Sep 8, 2011
Showing with 28 additions and 3 deletions.
  1. +1 −0 include/triq.hrl
  2. +22 −0 include/triq_statem.hrl
  3. +3 −1 src/triq_dom.erl
  4. +2 −2 src/triq_statem.erl
View
@@ -60,6 +60,7 @@
%%
-import(?DOMAIN_MODULE, [list/1, tuple/1, int/0, real/0, elements/1, any/0, atom/0,
choose/2, bool/0, char/0, oneof/1, return/1, vector/2, binary/0, binary/1,
+ non_empty/1,
shrink_without_duplicates/1, resize/2, frequency/1]).
View
@@ -0,0 +1,22 @@
+%%
+%% This file is part of Triq - Trifork QuickCheck
+%%
+%% Copyright (c) 2011 by Trifork
+%%
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+%%
+
+-import(triq_statem, [commands/1,
+ run_commands/2, run_commands/3,
+ state_after/2,
+ prop_statem/1]).
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 d60828a

Please sign in to comment.