mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-23 04:03:49 +00:00
0fc2022a0e
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>
30 lines
628 B
Go
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)
|
|
}
|
|
}
|