anchor.diff:                   PPP).
   
   -define(STATE, #gc_d_state).
  --record(mc_state, {current_state :: atom(),
  -                   previous_state :: atom()}).
  +-record(mc_state, {}).
   
   %%====================================================================
   %% Eunit tests
  
positive.code:     idle.
  
  initial_state_data() ->
      #mc_state{previous_state = idle}.
  
  next_state_data({paused, _}, {paused, _}, S, _R, {call, ?GCD_MODULE, cancel_batch, []}) ->
      S#mc_state{previous_state=idle};
  next_state_data(From, To, S, _R, _C) when From == To ->
      S;
  next_state_data(From, To, S, _R, _C) ->
      S#mc_state{current_state=To,
                 previous_state=From}.
  
  precondition(_From, _To, _S, _C) ->
      true.
  
  %% `idle' state transitions
  postcondition(idle, idle, _S ,{call, _M, cancel_batch, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= idle andalso R =:= {error, no_batch});
  postcondition(idle, {paused, _}, _S ,{call, _M, pause, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= paused andalso R =:= ok);
  postcondition(idle, fetching_next_batch, _S ,{call, _M, manual_batch, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= fetching_next_batch andalso R =:= ok);
  
  %% `fetching_next_batch' state transitions
  postcondition(fetching_next_batch, fetching_next_batch, _S ,{call, _M, manual_batch, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= fetching_next_batch andalso R =:= {error, already_deleting});
  postcondition(fetching_next_batch, {paused, _}, _S ,{call, _M, pause, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= paused andalso R =:= ok);
  postcondition(fetching_next_batch, idle, _S ,{call, _M, cancel_batch, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= idle andalso R =:= ok);
  postcondition(fetching_next_batch, feeding_workers, _S ,{call, _M, change_state, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= feeding_workers andalso R =:= ok);
  
  %% `feeding_workers' state transitions
  postcondition(feeding_workers, feeding_workers, _S ,{call, _M, manual_batch, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= feeding_workers andalso R =:= {error, already_deleting});
  postcondition(feeding_workers, {paused, _}, _S ,{call, _M, pause, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= paused andalso R =:= ok);
  postcondition(feeding_workers, idle, _S ,{call, _M, cancel_batch, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= idle andalso R =:= ok);
  postcondition(feeding_workers, fetching_next_batch, _S ,{call, _M, change_state, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= fetching_next_batch andalso R =:= ok);
  postcondition(feeding_workers, waiting_for_workers, _S ,{call, _M, change_state, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= waiting_for_workers andalso R =:= ok);
  
  %% `waiting_for_workers' state transitions
  postcondition(waiting_for_workers, waiting_for_workers, _S ,{call, _M, manual_batch, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= waiting_for_workers andalso R =:= {error, already_deleting});
  postcondition(waiting_for_workers, {paused, _}, _S ,{call, _M, pause, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= paused andalso R =:= ok);
  postcondition(waiting_for_workers, idle, _S ,{call, _M, cancel_batch, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= idle andalso R =:= ok);
  postcondition(waiting_for_workers, feeding_workers, _S ,{call, _M, change_state, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= feeding_workers andalso R =:= ok);
  
  %% `paused' state transitions
  postcondition({paused, _}, {paused, _}, _S ,{call, _M, manual_batch, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= paused andalso R =:= {error, already_paused});
  postcondition({paused, _}, {paused, _}, _S ,{call, _M, cancel_batch, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= paused andalso R =:= ok);
  postcondition({paused, _}, {paused, _}, _S ,{call, _M, pause, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= paused andalso R =:= {error, already_paused});
  postcondition({paused, _}, PrevState, #mc_state{previous_state=PrevState} ,{call, _M, resume, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= PrevState andalso R =:= ok);
  
  %% General handling of `resume' calls when the `From' state
  %% is not `paused'.
  postcondition(_From, To, _S ,{call, _M, resume, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= To andalso R =:= {error, not_paused});
  %% Handling of arbitrary calls that should return `ok'.
  postcondition(_From, To, _S ,{call, _M, _F, _}, R) ->
      {ActualState, _} = riak_cs_gc_d:current_state(),
      ?P(ActualState =:= actual_state(To) andalso R =:= ok);
  %% Catch all
  postcondition(_From, _To, _S , _C, _R) ->
      true.
  
  actual_state({State, _}) -> State;
  actual_state(S) -> S.
  
  weight(idle, fetching_next_batch, _) -> 10;
  weight(fetching_next_batch, feeding_workers, _) -> 5;
  
negative.code: 
  prop_status() ->
      ?FORALL({Interval, Last, Next,
               Start, Count, Skips, Batch},
              {int(), riak_cs_gen:datetime(), riak_cs_gen:datetime(),
               int(), int(), int(), list(int())},
              begin
                  State = ?STATE{interval=Interval,
                                 last=Last,
  