Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
add overflow test
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Newson committed Mar 8, 2011
1 parent f2bf15e commit e096b3d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/monic_file_writer_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
-include_lib("eunit/include/eunit.hrl").

all_test_() ->
{setup,
{foreach,
fun setup/0,
fun cleanup/1,
fun instantiate/1
[
fun write/1,
fun overflow/1
]
}.

setup() ->
Expand All @@ -32,10 +35,10 @@ setup() ->
cleanup(Pid) ->
monic_file_writer:close(Pid).

instantiate(Pid) ->
[write(Pid)].

write(Pid) ->
Res = monic_file_writer:write(Pid, 1, 2, 3, fun(_Max) -> {ok, <<"123">>} end),
?_assertEqual(ok, Res).

overflow(Pid) ->
Res = monic_file_writer:write(Pid, 1, 2, 3, fun(_Max) -> {ok, <<"1234">>} end),
?_assertEqual({error, overflow}, Res).

0 comments on commit e096b3d

Please sign in to comment.