diff --git a/src/ggs_player.erl b/src/ggs_player.erl index 79d0d06..2a9aee1 100644 --- a/src/ggs_player.erl +++ b/src/ggs_player.erl @@ -11,7 +11,7 @@ %% @doc Spawns a process representing the player in GGS. Takes the player socket as %% an argument for storage and later usage. Creates a unique player token %% identifying the player. -%% @spec start_link(Socket::socket()) -> ok +%% @spec start_link(Socket::socket()) -> {ok, Pid} | {error, Reason} start_link(Socket) -> loop(Socket). @@ -27,10 +27,11 @@ notify(Player, From, Message) -> get_token(_Player) -> helpers:not_implemented(). -%% @doc Properly terminates the player process. The player token will be destroyed. -%% Makes table token unreferenced and destroys the process in the end. +%% @doc Properly terminates the player process. The player token will be lost +%% together with the table token. It should also close the player socket and the +%% process should return in the end. %% @spec stop(Table::pid()) -> Reason::string() -stop(_Table) -> +stop(_Player,_Table) -> helpers:not_implemented(). %% Internals diff --git a/tests/ggs_player_test.erl b/tests/ggs_player_test.erl new file mode 100644 index 0000000..fc13eb5 --- /dev/null +++ b/tests/ggs_player_test.erl @@ -0,0 +1,23 @@ +-include_lib("eunit/include/eunit.hrl"). +-import(ggs_player). + +%% @doc start_link should always return ok for any valid socket. A valid socket +%% should always return {ok, Pid} and {error, Reason} otherwise. +start_link_test() -> + helpers:not_implemented(). + +%% @doc Given that start_link returned {ok, Player}. Notify shall always return ok and +%% deliver a specified message through the socket. +notify_test() -> + helpers:not_implemented(). + +%% @doc Given that start_link returned {ok, Player}. get_token shall always return a valid +%% player token. a valid token should be unique. +get_token_test() -> + helpers:not_implemented(). + +%% @doc Given that start_link returned {ok, Pid}. There shouldn't be possible to +%% execute this function with the same Player and Table arguments twice. +stop_test() -> + helpers:not_implemented(). +