anchor.diff:  %% Executes multiple test configurations.
   %% @end
   %%--------------------------------------------------------------------
  --spec exec_perf_config(M :: atom(), F :: atom(), Inputs :: list(), Ext :: list() | tuple(), Repeats :: integer()) -> ok.
  +-spec exec_perf_config(M :: atom(), F :: atom(), Inputs :: list(),
  +    Ext :: list() | tuple(), Repeats :: integer()) -> ok.
   exec_perf_config(M, F, Inputs, {Name, ExtList}, Repeats) ->
  -  exec_perf_config(M, F, Inputs, ExtList, Name, Repeats);
  +    exec_perf_config(M, F, Inputs, ExtList, Name, Repeats);
   exec_perf_config(M, F, Inputs, Ext, Repeats) ->
  -  exec_perf_config(M, F, Inputs, Ext, [], Repeats).
  +    exec_perf_config(M, F, Inputs, Ext, [], Repeats).
   
   %%--------------------------------------------------------------------
   %% @doc
   %% Executes multiple test configurations.
   %% @end
   %%--------------------------------------------------------------------
  --spec exec_perf_config(M :: atom(), F :: atom(), Inputs :: list(), Ext :: list(), ConfigName :: term(), Repeats :: integer()) -> ok.
  +-spec exec_perf_config(M :: atom(), F :: atom(), Inputs :: list(), Ext :: list(),
  +    ConfigName :: term(), Repeats :: integer()) -> ok.
   exec_perf_config(M, F, Inputs, Ext, ConfigName, Repeats) ->
  -  [I1] = Inputs,  % get first arg (test config)
  -  [Values, OkNum, Errors] = exec_multiple_tests(M, F, [I1 ++ Ext], Repeats),
  -  Json = case file:read_file("perf_results") of
  -    {ok, FileBinary} ->
  -      json_parser:parse_json_binary_to_atom_proplist(FileBinary);
  -    _ ->
  -      []
  -  end,
  -  {ok, File} = file:open("perf_results", [write]),
  -
  -
  -  MJson = proplists:get_value(M, Json, []),
  -  Json2 = proplists:delete(M, Json),
  -
  -  FJson = proplists:get_value(F, MJson, []),
  -  MJson2 = proplists:delete(F, MJson),
  -
  -  ConfKey = case ConfigName of
  -    N when is_atom(N) -> N;
  -    _ -> list_to_atom("config" ++ integer_to_list(length(FJson)+1))
  -  end,
  -
  -  Json3 = [
  -    {M, [
  -      {F, [
  -        {ConfKey,
  -          [
  -            {config_extension, Ext},
  -            {repeats, Repeats},
  -            {ok_counter, OkNum},
  -            {results, {struct, Values}},
  -            {errors, Errors}
  -          ]
  -        }
  -      | FJson]}
  -    | MJson2]}
  -  | Json2],
  -
  -  file:write(File, [iolist_to_binary(mochijson2:encode(prepare_to_write(Json3)))]),
  -  file:close(File),
  -  ok.
  +    [I1] = Inputs,  % get first arg (test config)
  +    [Values, OkNum, Errors] = exec_multiple_tests(M, F, [I1 ++ Ext], Repeats),
  +    Json = case file:read_file("perf_results") of
  +               {ok, FileBinary} ->
  +                   json_parser:parse_json_binary_to_atom_proplist(FileBinary);
  +               _ ->
  +                   []
  +           end,
  +    {ok, File} = file:open("perf_results", [write]),
  +
  +
  +    MJson = proplists:get_value(M, Json, []),
  +    Json2 = proplists:delete(M, Json),
  +
  +    FJson = proplists:get_value(F, MJson, []),
  +    MJson2 = proplists:delete(F, MJson),
  +
  +    ConfKey = case ConfigName of
  +                  N when is_atom(N) -> N;
  +                  _ ->
  +                      list_to_atom("config" ++ integer_to_list(length(FJson) + 1))
  +              end,
  +
  +    Json3 = [
  +        {M, [
  +            {F, [
  +                {ConfKey,
  +                    [
  +                        {config_extension, Ext},
  +                        {repeats, Repeats},
  +                        {ok_counter, OkNum},
  +                        {results, {struct, Values}},
  +                        {errors, Errors}
  +                    ]
  +                }
  +                | FJson]}
  +            | MJson2]}
  +        | Json2],
  +
  +    try
  +        file:write(File, [iolist_to_binary(mochijson2:encode(prepare_to_write(Json3)))])
  +    catch
  +        _:Err ->
  +            ct:print("~p ~n~p", [Err, erlang:get_stacktrace()])
  +    end,
  +    file:close(File),
  +    ok.
   
   %%--------------------------------------------------------------------
   %% @doc
   %% Executes test configuration many times. Returns [Values, OkNum, Errors].
   %% @end
   %%--------------------------------------------------------------------
  --spec exec_multiple_tests(M :: atom(), F :: atom(), Inputs :: list(), Count :: integer()) -> list().
  +-spec exec_multiple_tests(M :: atom(), F :: atom(), Inputs :: list(),
  +    Count :: integer()) -> list().
   exec_multiple_tests(M, F, Inputs, Count) ->
  -  exec_multiple_tests(M, F, Inputs, Count, [], 0, []).
  +    exec_multiple_tests(M, F, Inputs, Count, [], 0, []).
   
   exec_multiple_tests(_M, _F, _Inputs, 0, Values, OkNum, Errors) ->
  -  [Values, OkNum, Errors];
  +    [Values, OkNum, Errors];
   
   exec_multiple_tests(M, F, Inputs, Count, Values, OkNum, Errors) ->
  -  case exec_test(M, F, Inputs) of
  -    {error, E} ->
  -      exec_multiple_tests(M, F, Inputs, Count - 1, Values, OkNum, [E | Errors]);
  -    V ->
  -      case Values of
  -        [] ->
  -          exec_multiple_tests(M, F, Inputs, Count - 1, V, OkNum + 1, Errors);
  -        _ ->
  -          NewV = lists:zipwith(fun({K, V1}, {K, V2}) ->
  -            {K, V1 + V2}
  -          end, V, Values),
  -          exec_multiple_tests(M, F, Inputs, Count - 1, NewV, OkNum + 1, Errors)
  -      end
  -  end.
  +    case exec_test(M, F, Inputs) of
  +        {error, E} ->
  +            exec_multiple_tests(M, F, Inputs, Count - 1, Values, OkNum, [E | Errors]);
  +        V ->
  +            case Values of
  +                [] ->
  +                    exec_multiple_tests(M, F, Inputs, Count - 1, V, OkNum + 1, Errors);
  +                _ ->
  +                    NewV = lists:zipwith(fun({K, V1}, {K, V2}) ->
  +                        {K, V1 + V2}
  +                    end, V, Values),
  +                    exec_multiple_tests(M, F, Inputs, Count - 1, NewV, OkNum + 1, Errors)
  +            end
  +    end.
   
   %%--------------------------------------------------------------------
   %% @doc
  
positive.code: %%--------------------------------------------------------------------
  -spec check_links() -> ok | {error, term()}.
  check_links() ->
    receive
      {'EXIT', _, normal} ->
        check_links();
      {'EXIT',_,_} ->
        {error, linked_proc_error}
    after 0 ->
      ok
    end.
  
  %%--------------------------------------------------------------------
  %% @doc
  
negative.code: %%--------------------------------------------------------------------
  -spec around_advice(#annotation{}, M :: atom(), F :: atom(), Inputs :: list()) -> Result :: term().
  around_advice(#annotation{data = {perf_cases, Cases}}, M, F, Inputs) ->
      case os:getenv("perf_test") of
          "true" ->
              Cases;
          _ ->
              annotation:call_advised(M, F, Inputs)
      end;
  
  around_advice(#annotation{data = {_, _} = SingleExt}, M, F, Inputs) ->
      around_advice(#annotation{data = [SingleExt]}, M, F, Inputs);
  
  around_advice(#annotation{data = ConfExt}, M, F, Inputs) when is_list(ConfExt) ->
      case os:getenv("perf_test") of
          "true" ->
              process_flag(trap_exit, true),
              Repeats = proplists:get_value(repeats, ConfExt, 1),
              case proplists:get_value(perf_configs, ConfExt, []) of
                  [] ->
                      Ext = proplists:get_value(perf_config, ConfExt, []),
                      exec_perf_config(M, F, Inputs, Ext, Repeats);
                  Exts ->
                      lists:foreach(
                          fun(Ext) ->
                              exec_perf_config(M, F, Inputs, Ext, Repeats) end,
                          Exts)
              end;
          _ ->
              Ext = proplists:get_value(ct_config, ConfExt, []),
              [I1] = Inputs,  % get first arg (test config)
              annotation:call_advised(M, F, [I1 ++ Ext])
      end;
  
  around_advice(#annotation{}, M, F, Inputs) ->
      around_advice(#annotation{data = []}, M, F, Inputs).
  
  %%%===================================================================
  %%% Internal functions
  