erigon-pulse/common/sorted_test.go
Andrew Ashikhmin 0fc2022a0e
Extend fork ID to timestamp-based forks (#6324)
Starting from
[Shanghai](https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md),
forks are based on timestamps rather than block heights (see PR #6238).
This PR extends [EIP-2124](https://eips.ethereum.org/EIPS/eip-2124) Fork
ID to include timestamp-based blocks. See also
https://github.com/ethereum/go-ethereum/pull/25878.

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2022-12-16 12:08:54 +01:00

30 lines
628 B
Go

package common
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestRemoveDuplicatesFromSorted(t *testing.T) {
tests := []struct {
in []int
out []int
}{
{[]int{}, []int{}},
{[]int{1, 2, 5}, []int{1, 2, 5}},
{[]int{1, 1, 2, 5, 5, 5, 7}, []int{1, 2, 5, 7}},
{[]int{8, 8, 5, 4, 4, 4, 2}, []int{8, 5, 4, 2}},
{[]int{8, 8, 8, 8, 8, 4}, []int{8, 4}},
{[]int{1, 8, 8, 8, 8, 8}, []int{1, 8}},
{[]int{8, 8, 8, 8, 8}, []int{8}},
{[]int{-3, -3}, []int{-3}},
{[]int{-3}, []int{-3}},
}
for _, test := range tests {
x := RemoveDuplicatesFromSorted(test.in)
assert.Equal(t, test.out, x)
}
}