anchor.diff:  %% @doc Tests adding nodes to a neighborhood structure.
   -spec test_update_ids(any()) -> ok.
   test_update_ids(_Config) ->
  -    N8 = node:new(pid1,   8, 0),
  -    N9 = node:new(pid1,   9, 1), % N8 updated
  -    N14 = node:new(pid2, 14, 0),
  -    N15 = node:new(pid2, 15, 1), % N14 updated
  -    N20 = node:new(pid3, 20, 0),
  -    N33 = node:new(pid4, 33, 0),
  -    N42 = node:new(pid5, 42, 0),
  -    N50 = node:new(pid6, 50, 0),
  -    N66 = node:new(pid7, 66, 0),
  +    N8 = node:new(pid1,   ?KEY(8), 0),
  +    N9 = node:new(pid1,   ?KEY(9), 1), % N8 updated
  +    N14 = node:new(pid2, ?KEY(14), 0),
  +    N15 = node:new(pid2, ?KEY(15), 1), % N14 updated
  +    N20 = node:new(pid3, ?KEY(20), 0),
  +    N33 = node:new(pid4, ?KEY(33), 0),
  +    N42 = node:new(pid5, ?KEY(42), 0),
  +    N50 = node:new(pid6, ?KEY(50), 0),
  +    N66 = node:new(pid7, ?KEY(66), 0),
       
       Neighb1 = nodelist:mk_neighborhood([N8, N14, N50], N33),
       Neighb5 = nodelist:mk_neighborhood([N14], N33, 1, 1),
  
positive.code:     % Neighb1 = nodelist:mk_neighborhood([N8, N14, N42, N50], N33),
      % remove existing nodes:
      ?compare_neighborhood(nodelist:filter(Neighb1, fun(N) -> not node:same_process(N, N8) end, AddNodeToTabFun),
                            N33, 33, N14, [N14, N50, N42], N42, [N42, N50, N14], true, true),
      ?equals(_N11 = ets:tab2list(RemovedNodesTab), [{N8}]),
      ets:delete_all_objects(RemovedNodesTab),
      ?compare_neighborhood(nodelist:filter(Neighb1, fun(N) -> not node:same_process(N, N14) end, AddNodeToTabFun),
                            N33, 33, N8, [N8, N50, N42], N42, [N42, N50, N8], true, true),
      ?equals(_N12 = ets:tab2list(RemovedNodesTab), [{N14}]),
      ets:delete_all_objects(RemovedNodesTab),
      ?compare_neighborhood(nodelist:filter(Neighb1, fun(N) -> not node:same_process(N, N42) end, AddNodeToTabFun),
                            N33, 33, N14, [N14, N8, N50], N50, [N50, N8, N14], true, true),
      ?equals(_N13 = ets:tab2list(RemovedNodesTab), [{N42}]),
      ets:delete_all_objects(RemovedNodesTab),
      ?compare_neighborhood(nodelist:filter(Neighb1, fun(N) -> not node:same_process(N, N50) end, AddNodeToTabFun),
                            N33, 33, N14, [N14, N8, N42], N42, [N42, N8, N14], true, true),
      ?equals(_N14 = ets:tab2list(RemovedNodesTab), [{N50}]),
      ets:delete_all_objects(RemovedNodesTab),
      ?compare_neighborhood(nodelist:filter(Neighb1, fun(N) -> not lists:member(node:id(N), [8, 14]) end, AddNodeToTabFun),
                            N33, 33, N50, [N50, N42], N42, [N42, N50], true, true),
      ?equals(_N15 = lists:sort(ets:tab2list(RemovedNodesTab)), NodeListToTabListFun([N8, N14])),
      ets:delete_all_objects(RemovedNodesTab),
  
  
negative.code:     % Neighb1 = nodelist:mk_neighborhood([N8, N14, N50], N33),
      ?equals(nodelist:add_nodes(Neighb1, [], 3, 3), Neighb1),
      ?compare_neighborhood(nodelist:update_ids(Neighb1, [N20, N42, N66]),
                            N33, N14, [N14, N8, N50], N50, [N50, N8, N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb1, [N20, N42, N66, N42]),
                            N33, N14, [N14, N8, N50], N50, [N50, N8, N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb1, [N20, N42, N66, N9]),
                            N33, N14, [N14, N9, N50], N50, [N50, N9, N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb1, [N20, N9, N66, N42]),
                            N33, N14, [N14, N9, N50], N50, [N50, N9, N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb1, [N14]),
                            N33, N14, [N14, N8, N50], N50, [N50, N8, N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb1, [N20]),
                            N33, N14, [N14, N8, N50], N50, [N50, N8, N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb1, [N9]),
                            N33, N14, [N14, N9, N50], N50, [N50, N9, N14], true, true),
      
      % tests with (almost) empty successor/predecessor lists:
      % Neighb5 = nodelist:mk_neighborhood([N14], N33, 1, 1),
      ?equals(nodelist:update_ids(Neighb5, []), Neighb5),
      ?compare_neighborhood(nodelist:update_ids(Neighb5, [N20, N42, N66]),
                            N33, N14, [N14], N14, [N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb5, [N20, N42, N66, N42]),
                            N33, N14, [N14], N14, [N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb5, [N20, N42, N66, N15]),
                            N33, N15, [N15], N15, [N15], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb5, [N20, N15, N66, N42]),
                            N33, N15, [N15], N15, [N15], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb5, [N20]),
                            N33, N14, [N14], N14, [N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb5, [N14]),
                            N33, N14, [N14], N14, [N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb5, [N15]),
                            N33, N15, [N15], N15, [N15], true, true),
      
  %%     Neighb6 = nodelist:mk_neighborhood([], N33, 1, 1),
      ?equals(nodelist:update_ids(Neighb6, []), Neighb6),
      ?compare_neighborhood(nodelist:update_ids(Neighb6, [N20, N42, N66]),
                            N33, N33, [N33], N33, [N33], false, false),
      ?compare_neighborhood(nodelist:update_ids(Neighb6, [N20, N42, N66, N42]),
                            N33, N33, [N33], N33, [N33], false, false),
      ?compare_neighborhood(nodelist:update_ids(Neighb6, [N20, N42, N66, N33]),
                            N33, N33, [N33], N33, [N33], false, false),
      ?compare_neighborhood(nodelist:update_ids(Neighb6, [N20]),
                            N33, N33, [N33], N33, [N33], false, false),
      
      % some tests with the base node in the to-be-updated nodes:
      ?compare_neighborhood(nodelist:update_ids(Neighb1, [N20, N42, N33, N66]),
                            N33, N14, [N14, N8, N50], N50, [N50, N8, N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb1, [N20, N42, N66, N33]),
                            N33, N14, [N14, N8, N50], N50, [N50, N8, N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb1, [N33, N20, N42, N66]),
                            N33, N14, [N14, N8, N50], N50, [N50, N8, N14], true, true),
  
      ?compare_neighborhood(nodelist:update_ids(Neighb5, [N20, N42, N33, N66]),
                            N33, N14, [N14], N14, [N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb5, [N20, N42, N66, N33]),
                            N33, N14, [N14], N14, [N14], true, true),
      ?compare_neighborhood(nodelist:update_ids(Neighb5, [N33, N20, N42, N66]),
                            N33, N14, [N14], N14, [N14], true, true),
  
      ?compare_neighborhood(nodelist:update_ids(Neighb6, [N20, N42, N33, N66]),
                            N33, N33, [N33], N33, [N33], false, false),
      ?compare_neighborhood(nodelist:update_ids(Neighb6, [N20, N42, N66, N33]),
                            N33, N33, [N33], N33, [N33], false, false),
      ?compare_neighborhood(nodelist:update_ids(Neighb6, [N33, N20, N42, N66]),
                            N33, N33, [N33], N33, [N33], false, false),
      
      % some tests with an updated base node in the to-be-added nodes:
      ?expect_exception(nodelist:update_ids(nodelist:new_neighborhood(N14), [N15]),
  