interpreter_utils

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayElements

func ArrayElements(inter *interpreter.Interpreter, array *interpreter.ArrayValue) []interpreter.Value

func AssertValueSlicesEqual

func AssertValueSlicesEqual(t testing.TB, inter *interpreter.Interpreter, expected, actual []interpreter.Value) bool

func AssertValuesEqual

func AssertValuesEqual(t testing.TB, interpreter *interpreter.Interpreter, expected, actual interpreter.Value) bool

func NewTestInterpreter

func NewTestInterpreter(tb testing.TB) *interpreter.Interpreter

func NewTestInterpreterWithStorage added in v1.3.0

func NewTestInterpreterWithStorage(tb testing.TB, storage interpreter.Storage) *interpreter.Interpreter

func NewTestInterpreterWithStorageAndAtreeValidationConfig added in v1.3.0

func NewTestInterpreterWithStorageAndAtreeValidationConfig(
	tb testing.TB,
	storage interpreter.Storage,
	atreeValueValidationEnabled bool,
	atreeStorageValidationEnabled bool,
) *interpreter.Interpreter

func NewUnmeteredInMemoryStorage

func NewUnmeteredInMemoryStorage() interpreter.Storage

func RequireValuesEqual

func RequireValuesEqual(t testing.TB, inter *interpreter.Interpreter, expected, actual interpreter.Value)

func ValuesAreEqual

func ValuesAreEqual(inter *interpreter.Interpreter, expected, actual interpreter.Value) bool

Types

type DictionaryEntry

type DictionaryEntry[K, V any] struct {
	Key   K
	Value V
}

func DictionaryEntries

func DictionaryEntries[K, V any](
	inter *interpreter.Interpreter,
	dict *interpreter.DictionaryValue,
	fromKey func(interpreter.Value) (K, bool),
	fromVal func(interpreter.Value) (V, bool),
) ([]DictionaryEntry[K, V], bool)

DictionaryEntries is similar to DictionaryKeyValues, attempting to map untyped Values to concrete values using the provided morphisms. If a conversion fails, then this function returns (nil, false). Useful in contexts when Cadence values need to be extracted into their go counterparts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL