core: add flags to Storage.Find

It can be iterated over keys, values or both.
Prefix can be stripped.
This commit is contained in:
Evgeniy Stratonikov 2021-01-12 13:39:31 +03:00 committed by Roman Khimov
parent 2130e17f0c
commit 7fc0c04dba
8 changed files with 148 additions and 24 deletions

View file

@ -4,7 +4,9 @@ import (
"math/big"
"testing"
istorage "github.com/nspcc-dev/neo-go/pkg/core/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
"github.com/stretchr/testify/assert"
@ -23,6 +25,13 @@ func TestCallFlags(t *testing.T) {
require.EqualValues(t, contract.NoneFlag, callflag.NoneFlag)
}
func TestFindFlags(t *testing.T) {
require.EqualValues(t, storage.None, istorage.FindDefault)
require.EqualValues(t, storage.KeysOnly, istorage.FindKeysOnly)
require.EqualValues(t, storage.RemovePrefix, istorage.FindRemovePrefix)
require.EqualValues(t, storage.ValuesOnly, istorage.FindValuesOnly)
}
func TestStoragePutGet(t *testing.T) {
src := `
package foo