anchor.diff:  
       %% test srvlookup(Proto, Name)
   
  +
  +    %% make_weight_proportional(In)
  +    %%--------------------------------------------------------------------
  +    autotest:mark(?LINE, "make_weight_proportional/1 - 0"),
  +    MWP_E1 = #srventry{order  = 0, weight = 25, port   = 1},
  +    MWP_E2 = #srventry{order  = 0, weight = 25, port   = 2},
  +    MWP_E3 = #srventry{order  = 0, weight = 25, port   = 3},
  +    MWP_E4 = #srventry{order  = 0, weight = 25, port   = 4},
  +
  +    MWP_L1 = [MWP_E1, MWP_E2, MWP_E3, MWP_E4],
  +
  +    {MWP_T1, MWP_T2, MWP_T3} = erlang:now(),
  +    random:seed(MWP_T1, MWP_T2, MWP_T3),
  +
  +    MWP_Res1 = [make_weight_proportional(MWP_L1) || _ <- lists:seq(1, 1000)],
  +
  +    autotest:mark(?LINE, "make_weight_proportional/1 - 1"),
  +    MWP_E1_Count = test_mwp_count(MWP_Res1, MWP_E1, 0),
  +    MWP_E2_Count = test_mwp_count(MWP_Res1, MWP_E2, 0),
  +    MWP_E3_Count = test_mwp_count(MWP_Res1, MWP_E3, 0),
  +    MWP_E4_Count = test_mwp_count(MWP_Res1, MWP_E4, 0),
  +
  +    io:format("SRV sorting distribution : ~5s ~5s ~5s ~5s~n", ["A", "B", "C", "D"]),
  +    io:format("                           ~.5w ~.5w ~.5w ~.5w~n", [MWP_E1_Count, MWP_E2_Count,
  +								   MWP_E3_Count, MWP_E4_Count]),
  +
  +    MWP_1_Lower = 150,
  +    MWP_1_Upper = 350,
  +
  +    case (MWP_E1_Count < MWP_1_Lower) orelse (MWP_E1_Count > MWP_1_Upper) orelse
  +	 (MWP_E2_Count < MWP_1_Lower) orelse (MWP_E2_Count > MWP_1_Upper) orelse
  +	 (MWP_E3_Count < MWP_1_Lower) orelse (MWP_E3_Count > MWP_1_Upper) orelse
  +	 (MWP_E4_Count < MWP_1_Lower) orelse (MWP_E3_Count > MWP_1_Upper) of
  +	true ->
  +	    Msg = io_lib:format("SRV proportional weighting failure, value ~p/~p/~p/~p out of bounds (~p..~p)",
  +				[MWP_E1_Count, MWP_E2_Count, MWP_E3_Count, MWP_E4_Count, MWP_1_Lower, MWP_1_Upper]),
  +	    throw({error, lists:flatten(Msg)});
  +	false ->
  +	    ok
  +    end,
  +
  +    autotest:mark(?LINE, "make_weight_proportional/1 - 2"),
  +    %% test with error tuple (those are always last in the input to make_weight_proportional/1)
  +    MWP_L2 = [MWP_E1, MWP_E2, {error, nxdomain}],
  +    [#srventry{}, #srventry{}, {error, nxdomain}] = make_weight_proportional(MWP_L2),
  +
  +    autotest:mark(?LINE, "make_weight_proportional/1 - 3"),
  +    %% test with only error tuple
  +    MWP_L3 = [{error, nxdomain}],
  +    MWP_L3 = make_weight_proportional(MWP_L3),
  +
       ok.
  +
  +test_mwp_count([[H | _] | T], H, Count) ->
  +    test_mwp_count(T, H, Count + 1);
  +test_mwp_count([_ | T], H, Count) ->
  +    test_mwp_count(T, H, Count);
  +test_mwp_count([], _H, Count) ->
  +    Count.
   
   %% Neat function from Joe Armstrongs thesis (page 58). Creates all
   %% possible permutations of the input list :
  
positive.code:     case inet_res:nslookup(Name, in, srv) of
  	{ok, Rec} ->
  	    ParseSRV = fun(Entry) ->
  			       #srventry{proto=Proto, dnsrrdata=Entry#dns_rr.data}
  		       end,
  	    lists:map(ParseSRV, Rec#dns_rec.anlist);
  	{error, What} ->
  
negative.code: 	nomatch ->
  	    %% No domain NAPTR records found. Perform RFC2543 backwards compatible
  	    %% SRV lookup of the domain.
  	    logger:log(debug, "Resolver: Domain ~p has no NAPTR records, perform RFC2543 backwards "
  		       "compatible lookup for SIP SRV records under that domain name", [Domain]),
  	    TCP = srvlookup(tcp, "_sip._tcp." ++ Domain),
  	    UDP = srvlookup(udp, "_sip._udp." ++ Domain),
  	    TLS = srvlookup(tls, "_sips._tcp." ++ Domain),
  
  	    All = lists:flatten([TCP, UDP, TLS]),
  	    Sorted = sort_srvlist(All),
  	    R = combine_srvresults(Sorted),
  	    logger:log(debug, "Resolver: Result of RFC2543 compatible SIP SRV query for domain ~p :~n~p",
  		       [Domain, R]),
  	    R;
  