forked from TrueCloudLab/frostfs-contract
Vladimir Domnich
03bff785d2
Add method that allows to iterate over estimation records. Update tests to assert that list of estimations built with existing methods is identical to estimations from iterator. Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
23 lines
561 B
Go
23 lines
561 B
Go
package tests
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/interop/storage"
|
|
"github.com/nspcc-dev/neo-go/pkg/neotest"
|
|
"github.com/nspcc-dev/neo-go/pkg/neotest/chain"
|
|
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
|
)
|
|
|
|
func iteratorToArray(iter *storage.Iterator) []stackitem.Item {
|
|
stackItems := make([]stackitem.Item, 0)
|
|
for iter.Next() {
|
|
stackItems = append(stackItems, iter.Value())
|
|
}
|
|
return stackItems
|
|
}
|
|
|
|
func newExecutor(t *testing.T) *neotest.Executor {
|
|
bc, acc := chain.NewSingle(t)
|
|
return neotest.NewExecutor(t, bc, acc, acc)
|
|
}
|