anchor.diff:  -ifdef(TEST).
   -include_lib("eunit/include/eunit.hrl").
   -define(piecestate, ?MODULE).
  +
  +begun_test() ->
  +    ?assertEqual(ok, ?piecestate:begun(0, self())),
  +    ?assertEqual({piece, {begun, 0}}, etorrent_utils:first()).
   
   stored_test() ->
       ?assertEqual(ok, ?piecestate:stored(0, self())),
  
positive.code: 
  %% @doc
  %% @end
  -spec valid(non_neg_integer(), pid()) -> ok.
  valid(Piece, Srvpid) ->
      Srvpid ! {piece, {valid, Piece}},
      ok.
  
negative.code: %% This module provides a common interface for processes
  %% handling piece state changes.
  
  -export([begun/2,
           stored/2,
           valid/2]).
  
  -type pieceindex() :: etorrent_types:pieceindex().
  
  %% @doc
  %% @end
  -spec begun(pieceindex(), pid()) -> ok.
  begun(Piece, Srvpid) ->
      Srvpid ! {piece, {begun, Piece}},
      ok.
  
  
  %% @doc
  %% @end
  -spec stored(pieceindex(), pid()) -> ok.
  stored(Piece, Srvpid) ->
      Srvpid ! {piece, {stored, Piece}},
      ok.
  