mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 07:58:22 -05:00
Use DeepSSZEqual for tests (#8484)
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
@@ -105,7 +105,7 @@ func TestServer_ListAttestations_Genesis(t *testing.T) {
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.DeepEqual(t, wanted, res)
|
||||
require.DeepSSZEqual(t, wanted, res)
|
||||
}
|
||||
|
||||
func TestServer_ListAttestations_NoPagination(t *testing.T) {
|
||||
@@ -349,9 +349,7 @@ func TestServer_ListAttestations_Pagination_CustomPageParameters(t *testing.T) {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
res, err := bs.ListAttestations(ctx, test.req)
|
||||
require.NoError(t, err)
|
||||
if !proto.Equal(res, test.res) {
|
||||
t.Errorf("Incorrect attestations response, wanted \n%v, received \n%v", test.res, res)
|
||||
}
|
||||
require.DeepSSZEqual(t, res, test.res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,9 +271,7 @@ func TestServer_ListBlocks_Pagination(t *testing.T) {
|
||||
t.Run(fmt.Sprintf("test_%d", i), func(t *testing.T) {
|
||||
res, err := bs.ListBlocks(ctx, test.req)
|
||||
require.NoError(t, err)
|
||||
if !proto.Equal(res, test.res) {
|
||||
t.Errorf("Incorrect blocks response, wanted %v, received %v", test.res, res)
|
||||
}
|
||||
require.DeepSSZEqual(t, res, test.res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +225,8 @@ func deepValueBaseTypeEqual(v1, v2 reflect.Value) bool {
|
||||
return v1.Interface().(types.Epoch) == v2.Interface().(types.Epoch)
|
||||
case "Slot":
|
||||
return v1.Interface().(types.Slot) == v2.Interface().(types.Slot)
|
||||
case "CommitteeIndex":
|
||||
return v1.Interface().(types.CommitteeIndex) == v2.Interface().(types.CommitteeIndex)
|
||||
}
|
||||
return v1.Interface().(uint64) == v2.Interface().(uint64)
|
||||
case reflect.Uint32:
|
||||
|
||||
Reference in New Issue
Block a user