mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-07 10:12:19 +00:00
1ddb19bba6
sharding: create a syncer and a simulator package Former-commit-id: b392885510ba5a96e61278cbbe2c0ec6f9722ee8 [formerly 3a435eaf6805d02beae55656f155b2c3a66ee663] Former-commit-id: 0f6f3f2053ae77711e2072848b727b0dc9b92276
34 lines
825 B
Go
34 lines
825 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)
|
|
}
|
|
}
|
|
}
|