Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTP 19 fixes #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/chronos.erl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

-spec start_link(server_name()) -> {'ok', pid()} | 'ignore' | {'error', term()}.
start_link(ServerName) ->
gen_server:start_link({local, ServerName}, _Args = [], _Opts = []).
gen_server:start_link({local, ServerName}, ?MODULE, _Args = [], _Opts = []).

%% -start_link() -> {'ok',pid()} | 'ignore' | {'error',term()}.
%% start_link() ->
Expand Down
17 changes: 9 additions & 8 deletions test/chronos_eqc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ initial_state() ->
command(S) ->
frequency
([ {100, {call, timer_expiry, start_server, [server_name()]}} ]
++ [ {1000, {call, timer_expiry, start_timer, start_timer_args(S)}}
++ [ {1000, {call, timer_expiry, start_timer, args(start_timer, S)}}
|| S#state.servers /= [] ]
++ [ {200, {call, timer_expiry, stop_timer, stop_timer_args(S)}}
++ [ {200, {call, timer_expiry, stop_timer, args(stop_timer, S)}}
|| S#state.servers /= [] ]
++ [ {1000, {call, ?MODULE, advance_time, advance_time_args(S)}}
++ [ {1000, {call, ?MODULE, advance_time, args(advance_time, S)}}
|| S#state.servers /= [] andalso possible_to_advance_time(S) ]
).

Expand Down Expand Up @@ -169,15 +169,16 @@ timer_name() -> {timer, nat()}.
timer_duration() -> choose(10, 100).


start_timer_args(S) ->
args(start_timer, S) ->

?LET(Server, oneof(S#state.servers),
[Server, timer_name(), timer_duration()]).
[Server, timer_name(), timer_duration()]);

stop_timer_args(S) ->
args(stop_timer, S) ->
?LET({Server, Timer}, oneof( S#state.running ++ [{hd(S#state.servers), bogus}]),
[Server, Timer]).
[Server, Timer]);

advance_time_args(_S) ->
args(advance_time, _S) ->
[choose(5, 50)].

%%---------------------- OPERATIONS ----------------------
Expand Down