anchor.diff:      % between zero and twice the counter plus one.
       elements(lists:seq(0, 2*Counter+1)).
   
  +%%-----------------------------------------------------------------------------
  +%% utils
  +%%-----------------------------------------------------------------------------
  +
  +cleanup(StreamName) ->
  +    DirName = "data/cakedb_data"++StreamName++"/",
  +    file:delete(DirName++StreamName++".index"),
  +    file:delete(DirName++StreamName++".data"),
  +    file:del_dir(DirName),
  +    ok.
  
positive.code:                 application:start(?APP),
                  {History,State,Result} = run_commands(?MODULE, Cmds),
                  application:stop(?APP),
                  ?WHENFAIL(
                      io:format("\n\nHistory: ~w\n\nState: ~w\n\nResult: ~w\n\n",
                      [History,State,Result]),
  
negative.code: %% Statem callbacks
  %%-----------------------------------------------------------------------------
  
  % initialize the state machine
  initial_state() ->
      #state{streams = [], counter = 0}.
  
  % define the commands to test
  command(S) ->
      oneof([{call, ?SERVER, register_stream, [streamname()]},
             {call, ?SERVER, stream_filename, [streamid(S)]}]).
  
  % define when a command is valid
  precondition(_S, _command) ->
      true. % All preconditions are valid
  
  % define the state transitions triggered
  % by each command
  next_state(S, _V, {call, ?SERVER, register_stream, [Stream]}) ->
      case proplists:is_defined(Stream, S#state.streams) of
          true ->
  