anchor.diff:  
   -include_lib("eunit/include/eunit.hrl").
   
  --define(to_int(Value), list_to_integer(binary_to_list(Value))).
   -define(SHP_VERSION, 1).
   
  -% -type shp_metric_type() :: (<<"m">> | <<"mr">> | <<"g">> | <<"h">>).
   -type shp_metric_type() :: 'm' | 'mr' | 'g' | 'h'.
   
   -record(shp_metric, {key :: binary(),
  
positive.code:        end
        },
  
        {"parse_line valid metric tests",
         generator,
         fun() ->
                 Tests = [{<<"label:1|m">>, #shp_metric{key = <<"label">>,
                                                        value = 1,
                                                        type = 'm'}},
  
                          {<<"label:123|h">>, #shp_metric{key = <<"label">>,
                                                          value = 123,
                                                          type = 'h'}},
  
                          {<<"x:-123|g">>, #shp_metric{key = <<"x">>,
                                                          value = -123,
                                                          type = 'g'}},
  
  
                          {<<"x:123|h">>, #shp_metric{key = <<"x">>,
                                                          value = 123,
                                                          type = 'h'}},
  
                          % sample rate
                          {<<"x:123|h|@0.43">>, #shp_metric{key = <<"x">>,
                                                            value = 123,
                                                            type = 'h',
                                                            sample_rate = 0.43}}
                          
                         ],
                 [ ?_assertEqual(Expect, parse_line(In)) ||
                    {In, Expect} <- Tests ]
         end
        },
  
negative.code: parse_type(<<"mr">>) ->
      mr;
  parse_type(<<"g">>) ->
      g;
  parse_type(Unknown) ->
      throw({bad_metric, {unknown_type, Unknown}}).
  
  parse_sample_rate([]) ->
      undefined;
  parse_sample_rate([<<"@", FloatBin/binary>>]) ->
      try
          list_to_float(binary_to_list(FloatBin))
      catch
          error:badarg ->
              throw({bad_metric, {bad_sample_rate, FloatBin}})
      end;
  parse_sample_rate(L) ->
      throw({bad_metric, {bad_sample_rate, L}}).
  
  to_int(Value) when is_binary(Value) ->
      try
          list_to_integer(binary_to_list(Value))
      catch
          error:badarg ->
              throw({bad_metric, {bad_value, Value}})
      end.
  
  estatsd_shp_test_() ->
      {foreach,
  