erlang-proper.statem.mustache Maven / Gradle / Ivy
-module({{classname}}_statem).
-behaviour(proper_statem).
-include("{{packageName}}.hrl").
-include_lib("proper/include/proper_common.hrl").
-include_lib("stdlib/include/assert.hrl").
-compile(export_all).
-compile(nowarn_export_all).
-include("{{packageName}}_statem.hrl").
%%==============================================================================
%% The statem's property
%%==============================================================================
prop_main() ->
setup(),
?FORALL( Cmds
, proper_statem:commands(?MODULE)
, begin
cleanup(),
{ History
, State
, Result
} = proper_statem:run_commands(?MODULE, Cmds),
?WHENFAIL(
io:format("History: ~p\nState: ~p\nResult: ~p\nCmds: ~p\n",
[ History
, State
, Result
, proper_statem:command_names(Cmds)
]),
proper:aggregate( proper_statem:command_names(Cmds)
, Result =:= ok
)
)
end
).
%%==============================================================================
%% Setup
%%==============================================================================
setup() -> ok.
%%==============================================================================
%% Cleanup
%%==============================================================================
cleanup() -> ok.
%%==============================================================================
%% Initial State
%%==============================================================================
initial_state() -> #{}.
{{#operations}}
{{#operation}}
%%==============================================================================
%% {{operationId}}
%%==============================================================================
{{operationId}}({{#allParams}}{{#required}}{{^-first}}, {{/-first}}{{paramName}}{{/required}}{{/allParams}}) ->
{{classname}}_api:{{operationId}}({{#allParams}}{{#required}}{{^-first}}, {{/-first}}{{paramName}}{{/required}}{{/allParams}}).
{{operationId}}_args(_S) ->
[{{#allParams}}{{#required}}{{^-first}}, {{/-first}}{{dataType}}{{/required}}{{/allParams}}].
{{/operation}}
{{/operations}}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy