mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-11 04:00:05 +00:00
9ab76dc1f6
Former-commit-id: 797bc1cf3a759f2a55dbf1ce790c3f599682448c [formerly 8f4e5d953c3e553944db263a76c142ffccad516d] Former-commit-id: c7c1e3e2d340c8cd5f97e4549fa46a7959be06c6
34 lines
831 B
Go
34 lines
831 B
Go
package p2p
|
|
|
|
import "testing"
|
|
|
|
func TestFeed_ReturnsSameFeed(t *testing.T) {
|
|
tests := []struct {
|
|
a interface{}
|
|
b interface{}
|
|
want bool
|
|
}{
|
|
// Equality tests
|
|
{a: 1, b: 2, want: true},
|
|
{a: 'a', b: 'b', want: true},
|
|
{a: struct{ c int }{c: 1}, b: struct{ c int }{c: 2}, want: true},
|
|
{a: struct{ c string }{c: "a"}, b: struct{ c string }{c: "b"}, want: true},
|
|
// Inequality tests
|
|
{a: 1, b: '2', want: false},
|
|
{a: 'a', b: 1, want: false},
|
|
{a: struct{ c int }{c: 1}, b: struct{ c int64 }{c: 2}, want: false},
|
|
{a: struct{ c string }{c: "a"}, b: struct{ c float64 }{c: 3.4}, want: false},
|
|
}
|
|
|
|
s, _ := NewServer()
|
|
|
|
for _, tt := range tests {
|
|
feed1, _ := s.Feed(tt.a)
|
|
feed2, _ := s.Feed(tt.b)
|
|
|
|
if (feed1 == feed2) != tt.want {
|
|
t.Errorf("Expected %v == %v to be %t", feed1, feed2, tt.want)
|
|
}
|
|
}
|
|
}
|