MCPcopy Create free account
hub / github.com/encodeous/nylon / TestGetNeighbour

Function TestGetNeighbour

state/routing_test.go:5–21  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func TestGetNeighbour(t *testing.T) {
6 n1 := &Neighbour{Id: "node1"}
7 n2 := &Neighbour{Id: "node2"}
8 rs := &RouterState{
9 Neighbours: []*Neighbour{n1, n2},
10 }
11
12 if got := rs.GetNeighbour("node1"); got != n1 {
13 t.Errorf("Expected neighbour node1 to be %+v, got %+v", n1, got)
14 }
15 if got := rs.GetNeighbour("node2"); got != n2 {
16 t.Errorf("Expected neighbour node2 to be %+v, got %+v", n2, got)
17 }
18 if got := rs.GetNeighbour("node3"); got != nil {
19 t.Errorf("Expected nil for missing neighbour node3, got %+v", got)
20 }
21}

Callers

nothing calls this directly

Calls 1

GetNeighbourMethod · 0.95

Tested by

no test coverage detected