anchor.diff:  
   maybe_pad(Bin) ->
       Bin.
  +
  +
  +%% =============================================================================
  +%% EUNIT TESTS
  +%% =============================================================================
  +
  +
  +
  +-ifdef(TEST).
  +
  +-include_lib("eunit/include/eunit.hrl").
  +
  +init_test() ->
  +    %% A hack to resolve node name
  +    partisan_config:init(),
  +    partisan_config:set(name, 'test@127.0.0.1'),
  +    partisan_config:set(nodestring, <<"test@127.0.0.1">>),
  +    ok.
  +
  +
  +local_pid_test() ->
  +    partisan_config:set(remote_ref_as_uri, false),
  +    Ref = from_term(self()),
  +    ?assert(is_pid(Ref)),
  +    ?assert(not is_reference(Ref)),
  +    ?assert(not is_name(Ref)),
  +    ?assert(is_type(Ref)),
  +    ?assert(is_local(Ref)),
  +    ?assertEqual(partisan:node(), ?MODULE:node(Ref)),
  +    ?assertEqual(partisan:nodestring(), ?MODULE:nodestring(Ref)),
  +    ?assertEqual(
  +        self(),
  +        to_term(Ref)
  +    ),
  +
  +    partisan_config:set(remote_ref_as_uri, true),
  +    UriRef = from_term(self()),
  +    ?assert(is_pid(UriRef)),
  +    ?assert(not is_reference(UriRef)),
  +    ?assert(not is_name(UriRef)),
  +    ?assert(is_type(UriRef)),
  +    ?assert(is_local(UriRef)),
  +    ?assertEqual(partisan:node(), ?MODULE:node(UriRef)),
  +    ?assertEqual(partisan:nodestring(), ?MODULE:nodestring(UriRef)),
  +    ?assertEqual(
  +        self(),
  +        to_term(UriRef)
  +    ).
  +
  +
  +local_name_test() ->
  +    partisan_config:set(remote_ref_as_uri, false),
  +    Ref = from_term(foo),
  +    ?assert(not is_pid(Ref)),
  +    ?assert(not is_reference(Ref)),
  +    ?assert(is_name(Ref)),
  +    ?assert(is_type(Ref)),
  +    ?assert(is_local(Ref)),
  +    ?assertEqual(partisan:node(), ?MODULE:node(Ref)),
  +    ?assertEqual(partisan:nodestring(), ?MODULE:nodestring(Ref)),
  +    ?assertEqual(
  +        foo,
  +        to_term(Ref)
  +    ),
  +
  +    partisan_config:set(remote_ref_as_uri, true),
  +    UriRef = from_term(foo),
  +    ?assert(not is_pid(UriRef)),
  +    ?assert(not is_reference(UriRef)),
  +    ?assert(is_name(UriRef)),
  +    ?assert(is_type(UriRef)),
  +    ?assert(is_local(UriRef)),
  +    ?assertEqual(partisan:node(), ?MODULE:node(UriRef)),
  +    ?assertEqual(partisan:nodestring(), ?MODULE:nodestring(UriRef)),
  +    ?assertEqual(
  +        foo,
  +        to_term(UriRef)
  +    ).
  +
  +local_ref_test() ->
  +    ERef = make_ref(),
  +    partisan_config:set(remote_ref_as_uri, false),
  +    Ref = from_term(ERef),
  +    ?assert(not is_pid(Ref)),
  +    ?assert(is_reference(Ref)),
  +    ?assert(not is_name(Ref)),
  +    ?assert(is_type(Ref)),
  +    ?assert(is_local(Ref)),
  +    ?assertEqual(partisan:node(), ?MODULE:node(Ref)),
  +    ?assertEqual(partisan:nodestring(), ?MODULE:nodestring(Ref)),
  +    ?assertEqual(
  +        ERef,
  +        to_term(Ref)
  +    ),
  +
  +    partisan_config:set(remote_ref_as_uri, true),
  +    UriRef = from_term(ERef),
  +    ?assert(not is_pid(UriRef)),
  +    ?assert(is_reference(UriRef)),
  +    ?assert(not is_name(UriRef)),
  +    ?assert(is_type(UriRef)),
  +    ?assert(is_local(UriRef)),
  +    ?assertEqual(partisan:node(), ?MODULE:node(UriRef)),
  +    ?assertEqual(partisan:nodestring(), ?MODULE:nodestring(UriRef)),
  +    ?assertEqual(
  +        ERef,
  +        to_term(UriRef)
  +    ).
  +
  +
  +
  +-endif.
positive.code: -export([is_reference/1]).
  -export([is_type/1]).
  -export([node/1]).
  -export([to_term/1]).
  
  
  
negative.code:     Node =:= partisan:node() orelse error(badarg),
      case Type of
          partisan_process_reference -> list_to_pid(Value);
          partisan_encoded_reference -> list_to_ref(Value);
          partisan_registered_name_reference -> list_to_atom(Value)
      end.
  
  
  %% @private
  get_node(Bin) ->
      Nodestring = get_nodestring(Bin),
      binary_to_existing_atom(Nodestring, utf8).
  
  
  %% @private
  get_nodestring(Bin) ->
      case binary:split(Bin, <<$:>>) of
          [Node | _]  ->
              Node;
          _ ->
              error(badarg)
      end.
  