Source

badtaste / extern / meck / .eunit / meck_performance_test.COVER.html

Full commit
<html>
<head><title>.eunit/meck_performance_test.COVER.html</title></head><body bgcolor=white text=black>
<pre>
File generated from /mnt/work/dev/home/kissbang/extern/meck/.eunit/meck_performance_test.erl by COVER 2012-05-31 at 11:17:37

****************************************************************************

        |  %% @doc
        |  -module(meck_performance_test).
        |  
        |  %% Interface exports
        |  -export([run/1]).
        |  
        |  %%==============================================================================
        |  %% Interface exports
        |  %%==============================================================================
        |  
        |  run(N) -&gt;
<font color=red>     0..|      meck:new(test),</font>
<font color=red>     0..|      io:format("\t\tMin\tMax\tMed\tAvg~n"),</font>
<font color=red>     0..|      io:format("expect/3\t~p\t~p\t~p\t~p~n",</font>
<font color=red>     0..|                test_avg(meck, expect, [test, normal, fun() -&gt; ok end], N)),</font>
<font color=red>     0..|      io:format("expect/3+args\t~p\t~p\t~p\t~p~n",</font>
        |                test_avg(meck, expect, [test, normal_args,
<font color=red>     0..|                                        fun(_, _) -&gt; ok end], N)),</font>
<font color=red>     0..|      io:format("expect/4\t~p\t~p\t~p\t~p~n",</font>
        |                test_avg(meck, expect, [test, shortcut, 0, ok], N)),
<font color=red>     0..|      io:format("expect/4+args\t~p\t~p\t~p\t~p~n",</font>
        |                test_avg(meck, expect, [test, shortcut_args, 2, ok], N)),
        |  
<font color=red>     0..|      meck:expect(test, shortcut_opaque, 0, self()),</font>
        |  
<font color=red>     0..|      io:format("~n\t\tMin\tMax\tMed\tAvg~n"),</font>
<font color=red>     0..|      io:format("normal\t\t~p\t~p\t~p\t~p~n",</font>
        |                test_avg(test, normal, [], N)),
<font color=red>     0..|      io:format("normal_args\t~p\t~p\t~p\t~p~n",</font>
        |                test_avg(test, normal_args, [a, b], N)),
<font color=red>     0..|      io:format("shortcut\t~p\t~p\t~p\t~p~n",</font>
        |                test_avg(test, shortcut, [], N)),
<font color=red>     0..|      io:format("shortcut_args\t~p\t~p\t~p\t~p~n",</font>
        |                test_avg(test, shortcut_args, [a, b], N)),
<font color=red>     0..|      io:format("shortcut_opaque\t~p\t~p\t~p\t~p~n",</font>
        |                test_avg(test, shortcut_opaque, [], N)),
<font color=red>     0..|      meck:unload(test),</font>
        |  
<font color=red>     0..|      meck:new(test),</font>
<font color=red>     0..|      meck:expect(test, func, 1, ok),</font>
<font color=red>     0..|      [test:func(I) || I &lt;- lists:seq(1, 100)],</font>
<font color=red>     0..|      io:format("~n\t\tMin\tMax\tMed\tAvg~n"),</font>
<font color=red>     0..|      io:format("called\t\t~p\t~p\t~p\t~p~n",</font>
        |                test_avg(meck, called, [test, func, 50], N)),
<font color=red>     0..|      meck:unload(test),</font>
<font color=red>     0..|      ok.</font>
        |  
        |  %%==============================================================================
        |  %% Internal functions
        |  %%==============================================================================
        |  
        |  test_avg(M, F, A, N) when N &gt; 0 -&gt;
<font color=red>     0..|      L = test_loop(M, F, A, N, []),</font>
<font color=red>     0..|      Length = length(L),</font>
<font color=red>     0..|      Min = lists:min(L),</font>
<font color=red>     0..|      Max = lists:max(L),</font>
<font color=red>     0..|      Med = lists:nth(round((Length / 2)), lists:sort(L)),</font>
<font color=red>     0..|      Avg = round(lists:foldl(fun(X, Sum) -&gt; X + Sum end, 0, L) / Length),</font>
<font color=red>     0..|      [Min, Max, Med, Avg].</font>
        |  
        |  test_loop(_M, _F, _A, 0, List) -&gt;
<font color=red>     0..|      List;</font>
        |  test_loop(M, F, A, N, List) -&gt;
<font color=red>     0..|      {T, _Result} = timer:tc(M, F, A),</font>
<font color=red>     0..|      test_loop(M, F, A, N - 1, [T|List]).</font>
</pre>
</body>
</html>