Files

48 lines
1.5 KiB
Go

// (c) 2020-2020, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package deployerallowlist
import (
"testing"
"github.com/luxfi/evm/precompile/allowlist"
"github.com/luxfi/evm/precompile/precompileconfig"
"github.com/luxfi/evm/precompile/testutils"
"github.com/luxfi/evm/utils"
"github.com/luxfi/geth/common"
"go.uber.org/mock/gomock"
)
func TestVerify(t *testing.T) {
allowlist.VerifyPrecompileWithAllowListTests(t, Module, nil)
}
func TestEqual(t *testing.T) {
admins := []common.Address{allowlist.TestAdminAddr}
enableds := []common.Address{allowlist.TestEnabledAddr}
managers := []common.Address{allowlist.TestManagerAddr}
tests := map[string]testutils.ConfigEqualTest{
"non-nil config and nil other": {
Config: NewConfig(utils.NewUint64(3), admins, enableds, managers),
Other: nil,
Expected: false,
},
"different type": {
Config: NewConfig(nil, nil, nil, nil),
Other: precompileconfig.NewMockConfig(gomock.NewController(t)),
Expected: false,
},
"different timestamp": {
Config: NewConfig(utils.NewUint64(3), admins, enableds, managers),
Other: NewConfig(utils.NewUint64(4), admins, enableds, managers),
Expected: false,
},
"same config": {
Config: NewConfig(utils.NewUint64(3), admins, enableds, managers),
Other: NewConfig(utils.NewUint64(3), admins, enableds, managers),
Expected: true,
},
}
allowlist.EqualPrecompileWithAllowListTests(t, Module, tests)
}