Permalink
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (29 sloc) 680 Bytes
-include_lib("eunit/include/eunit.hrl").
-define(MEG, 1048576).
simple_streaming_test() ->
Bits = ?MEG*8,
Bin = <<0:Bits>>,
?MEG = byte_size(Bin),
Ref = make_ref(),
Parent = self(),
process_flag(trap_exit, true),
Receiver = spawn_link(fun() ->
receive
{Ref, Sender} ->
Results = recv(Sender, Ref, 1000),
Parent ! {Ref, Results}
end
end),
Sender = spawn_link(fun() ->
send(Receiver, Ref, {context, [Bin]})
end),
Receiver ! {Ref, Sender},
{ok, {context, [Bin]}} = receive
{Ref, Results} -> Results
end,
receive
{'EXIT', Receiver, _} -> ok
end,
receive
{'EXIT', Sender, _} -> ok
end.