gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/router/route_test.go (about) 1 package router 2 3 import "testing" 4 5 func TestHash(t *testing.T) { 6 route1 := Route{ 7 Service: "dest.svc", 8 Gateway: "dest.gw", 9 Network: "dest.network", 10 Link: "det.link", 11 Metric: 10, 12 } 13 14 // make a copy 15 route2 := route1 16 17 route1Hash := route1.Hash() 18 route2Hash := route2.Hash() 19 20 // we should get the same hash 21 if route1Hash != route2Hash { 22 t.Errorf("identical routes result in different hashes") 23 } 24 }