mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-06 08:16:03 +02:00
25 lines
416 B
Go
25 lines
416 B
Go
package router
|
|
|
|
import "testing"
|
|
|
|
func TestHash(t *testing.T) {
|
|
route1 := Route{
|
|
Service: "dest.svc",
|
|
Gateway: "dest.gw",
|
|
Network: "dest.network",
|
|
Link: "det.link",
|
|
Metric: 10,
|
|
}
|
|
|
|
// make a copy
|
|
route2 := route1
|
|
|
|
route1Hash := route1.Hash()
|
|
route2Hash := route2.Hash()
|
|
|
|
// we should get the same hash
|
|
if route1Hash != route2Hash {
|
|
t.Errorf("identical routes result in different hashes")
|
|
}
|
|
}
|