test_utils

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CBORTagSomeValue = 165
)
View Source
const CompositeTypeInfoTagNum = 246

Variables

This section is empty.

Functions

func ArrayEqual

func ArrayEqual(expected ExpectedArrayValue, actual *atree.Array) (bool, error)

func CompareTypeInfo

func CompareTypeInfo(a, b atree.TypeInfo) bool

func CompareValue

func CompareValue(storage atree.SlabStorage, value atree.Value, storable atree.Storable) (bool, error)

CompareValue is used to set elements in OrderedMap.

func DecodeStorable

func DecodeStorable(dec *cbor.StreamDecoder, id atree.SlabID, inlinedExtraData []atree.ExtraData) (atree.Storable, error)

func DecodeTypeInfo

func DecodeTypeInfo(dec *cbor.StreamDecoder) (atree.TypeInfo, error)

func GetHashInput

func GetHashInput(value atree.Value, buffer []byte) ([]byte, error)

func MapEqual

func MapEqual(expected ExpectedMapValue, actual *atree.OrderedMap) (bool, error)

func ValueEqual

func ValueEqual(expected atree.Value, actual atree.Value) (bool, error)

Types

type CompositeTypeInfo

type CompositeTypeInfo struct {
	// contains filtered or unexported fields
}

func NewCompositeTypeInfo

func NewCompositeTypeInfo(value uint64) CompositeTypeInfo

func (CompositeTypeInfo) Copy

func (i CompositeTypeInfo) Copy() atree.TypeInfo

func (CompositeTypeInfo) Encode

func (i CompositeTypeInfo) Encode(enc *cbor.StreamEncoder) error

func (CompositeTypeInfo) Equal

func (i CompositeTypeInfo) Equal(other atree.TypeInfo) bool

func (CompositeTypeInfo) Identifier

func (i CompositeTypeInfo) Identifier() string

func (CompositeTypeInfo) IsComposite

func (i CompositeTypeInfo) IsComposite() bool

type ExpectedArrayValue

type ExpectedArrayValue []atree.Value

func (ExpectedArrayValue) Storable

type ExpectedMapValue

type ExpectedMapValue map[atree.Value]atree.Value

func (ExpectedMapValue) Storable

type ExpectedWrapperValue

type ExpectedWrapperValue struct {
	Value atree.Value
}

func NewExpectedWrapperValue

func NewExpectedWrapperValue(value atree.Value) ExpectedWrapperValue

func (ExpectedWrapperValue) Storable

type HashableMap

type HashableMap struct {
	// contains filtered or unexported fields
}

func NewHashableMap

func NewHashableMap(m *atree.OrderedMap) *HashableMap

func (*HashableMap) HashInput

func (v *HashableMap) HashInput(scratch []byte) ([]byte, error)

func (*HashableMap) Storable

func (v *HashableMap) Storable(storage atree.SlabStorage, address atree.Address, maxInlineSize uint64) (atree.Storable, error)

type HashableValue

type HashableValue interface {
	atree.Value
	HashInput(scratch []byte) ([]byte, error)
}

type InMemBaseStorage

type InMemBaseStorage struct {
	// contains filtered or unexported fields
}

func NewInMemBaseStorage

func NewInMemBaseStorage() *InMemBaseStorage

func NewInMemBaseStorageFromMap

func NewInMemBaseStorageFromMap(segments map[atree.SlabID][]byte) *InMemBaseStorage

func (*InMemBaseStorage) BytesRetrieved

func (s *InMemBaseStorage) BytesRetrieved() int

func (*InMemBaseStorage) BytesStored

func (s *InMemBaseStorage) BytesStored() int

func (*InMemBaseStorage) GenerateSlabID

func (s *InMemBaseStorage) GenerateSlabID(address atree.Address) (atree.SlabID, error)

func (*InMemBaseStorage) Remove

func (s *InMemBaseStorage) Remove(id atree.SlabID) error

func (*InMemBaseStorage) ResetReporter

func (s *InMemBaseStorage) ResetReporter()

func (*InMemBaseStorage) Retrieve

func (s *InMemBaseStorage) Retrieve(id atree.SlabID) ([]byte, bool, error)

func (*InMemBaseStorage) SegmentCounts

func (s *InMemBaseStorage) SegmentCounts() int

func (*InMemBaseStorage) SegmentsReturned

func (s *InMemBaseStorage) SegmentsReturned() int

func (*InMemBaseStorage) SegmentsTouched

func (s *InMemBaseStorage) SegmentsTouched() int

func (*InMemBaseStorage) SegmentsUpdated

func (s *InMemBaseStorage) SegmentsUpdated() int

func (*InMemBaseStorage) Size

func (s *InMemBaseStorage) Size() int

func (*InMemBaseStorage) Store

func (s *InMemBaseStorage) Store(id atree.SlabID, data []byte) error

type MutableStorable

type MutableStorable struct {
	// contains filtered or unexported fields
}

func (*MutableStorable) ByteSize

func (s *MutableStorable) ByteSize() uint32

func (*MutableStorable) ChildStorables

func (*MutableStorable) ChildStorables() []atree.Storable

func (*MutableStorable) Encode

func (*MutableStorable) Encode(*atree.Encoder) error

func (*MutableStorable) StoredValue

func (s *MutableStorable) StoredValue(atree.SlabStorage) (atree.Value, error)

type MutableValue

type MutableValue struct {
	// contains filtered or unexported fields
}

func NewMutableValue

func NewMutableValue(storableSize uint32) *MutableValue

func (*MutableValue) Storable

func (*MutableValue) UpdateStorableSize

func (v *MutableValue) UpdateStorableSize(n uint32)

type SimpleTypeInfo

type SimpleTypeInfo struct {
	// contains filtered or unexported fields
}

func NewSimpleTypeInfo

func NewSimpleTypeInfo(value uint64) SimpleTypeInfo

func (SimpleTypeInfo) Copy

func (i SimpleTypeInfo) Copy() atree.TypeInfo

func (SimpleTypeInfo) Encode

func (i SimpleTypeInfo) Encode(enc *cbor.StreamEncoder) error

func (SimpleTypeInfo) Equal

func (i SimpleTypeInfo) Equal(other atree.TypeInfo) bool

func (SimpleTypeInfo) Identifier

func (i SimpleTypeInfo) Identifier() string

func (SimpleTypeInfo) IsComposite

func (i SimpleTypeInfo) IsComposite() bool

func (SimpleTypeInfo) Value

func (i SimpleTypeInfo) Value() uint64

type SomeStorable

type SomeStorable struct {
	Storable atree.Storable
}

func (SomeStorable) ByteSize

func (s SomeStorable) ByteSize() uint32

func (SomeStorable) ChildStorables

func (s SomeStorable) ChildStorables() []atree.Storable

func (SomeStorable) Encode

func (s SomeStorable) Encode(e *atree.Encoder) error

func (SomeStorable) HasPointer

func (s SomeStorable) HasPointer() bool

func (SomeStorable) StoredValue

func (s SomeStorable) StoredValue(storage atree.SlabStorage) (atree.Value, error)

func (SomeStorable) String

func (s SomeStorable) String() string

func (SomeStorable) UnwrapAtreeStorable

func (s SomeStorable) UnwrapAtreeStorable() atree.Storable

func (SomeStorable) WrapAtreeStorable

func (s SomeStorable) WrapAtreeStorable(storable atree.Storable) atree.Storable

type SomeValue

type SomeValue struct {
	Value atree.Value
}

func NewSomeValue

func NewSomeValue(v atree.Value) SomeValue

func (SomeValue) HashInput

func (v SomeValue) HashInput(scratch []byte) ([]byte, error)

func (SomeValue) Storable

func (v SomeValue) Storable(
	storage atree.SlabStorage,
	address atree.Address,
	maxInlineSize uint64,
) (atree.Storable, error)

func (SomeValue) String

func (v SomeValue) String() string

func (SomeValue) UnwrapAtreeValue

func (v SomeValue) UnwrapAtreeValue() (atree.Value, uint64)

type StringValue

type StringValue struct {
	// contains filtered or unexported fields
}

func NewStringValue

func NewStringValue(s string) StringValue

func (StringValue) ByteSize

func (v StringValue) ByteSize() uint32

func (StringValue) ChildStorables

func (v StringValue) ChildStorables() []atree.Storable

func (StringValue) Copy

func (v StringValue) Copy() atree.Storable

func (StringValue) Encode

func (v StringValue) Encode(enc *atree.Encoder) error

func (StringValue) Equal

func (v StringValue) Equal(other atree.Storable) bool

func (StringValue) HashInput

func (v StringValue) HashInput(scratch []byte) ([]byte, error)

func (StringValue) ID

func (v StringValue) ID() string

func (StringValue) Less

func (v StringValue) Less(other atree.Storable) bool

func (StringValue) Storable

func (v StringValue) Storable(storage atree.SlabStorage, address atree.Address, maxInlineSize uint64) (atree.Storable, error)

func (StringValue) StoredValue

func (v StringValue) StoredValue(_ atree.SlabStorage) (atree.Value, error)

func (StringValue) String

func (v StringValue) String() string

type Uint16Value

type Uint16Value uint16

func (Uint16Value) ByteSize

func (v Uint16Value) ByteSize() uint32

func (Uint16Value) ChildStorables

func (v Uint16Value) ChildStorables() []atree.Storable

func (Uint16Value) Encode

func (v Uint16Value) Encode(enc *atree.Encoder) error

func (Uint16Value) HashInput

func (v Uint16Value) HashInput(scratch []byte) ([]byte, error)

func (Uint16Value) Storable

func (Uint16Value) StoredValue

func (v Uint16Value) StoredValue(_ atree.SlabStorage) (atree.Value, error)

func (Uint16Value) String

func (v Uint16Value) String() string

type Uint32Value

type Uint32Value uint32

func (Uint32Value) ByteSize

func (v Uint32Value) ByteSize() uint32

func (Uint32Value) ChildStorables

func (v Uint32Value) ChildStorables() []atree.Storable

func (Uint32Value) Encode

func (v Uint32Value) Encode(enc *atree.Encoder) error

Encode encodes UInt32Value as

cbor.Tag{
		Number:  cborTagUInt32Value,
		Content: uint32(v),
}

func (Uint32Value) HashInput

func (v Uint32Value) HashInput(scratch []byte) ([]byte, error)

func (Uint32Value) Storable

func (Uint32Value) StoredValue

func (v Uint32Value) StoredValue(_ atree.SlabStorage) (atree.Value, error)

func (Uint32Value) String

func (v Uint32Value) String() string

type Uint64Value

type Uint64Value uint64

func NewUint64ValueFromInteger

func NewUint64ValueFromInteger(i int) Uint64Value

func (Uint64Value) ByteSize

func (v Uint64Value) ByteSize() uint32

func (Uint64Value) ChildStorables

func (v Uint64Value) ChildStorables() []atree.Storable

func (Uint64Value) Encode

func (v Uint64Value) Encode(enc *atree.Encoder) error

Encode encodes UInt64Value as

cbor.Tag{
		Number:  cborTagUInt64Value,
		Content: uint64(v),
}

func (Uint64Value) HashInput

func (v Uint64Value) HashInput(scratch []byte) ([]byte, error)

func (Uint64Value) Storable

func (Uint64Value) StoredValue

func (v Uint64Value) StoredValue(_ atree.SlabStorage) (atree.Value, error)

func (Uint64Value) String

func (v Uint64Value) String() string

type Uint8Value

type Uint8Value uint8

func (Uint8Value) ByteSize

func (v Uint8Value) ByteSize() uint32

func (Uint8Value) ChildStorables

func (v Uint8Value) ChildStorables() []atree.Storable

func (Uint8Value) Encode

func (v Uint8Value) Encode(enc *atree.Encoder) error

Encode encodes UInt8Value as

cbor.Tag{
		Number:  cborTagUInt8Value,
		Content: uint8(v),
}

func (Uint8Value) HashInput

func (v Uint8Value) HashInput(scratch []byte) ([]byte, error)

func (Uint8Value) Storable

func (Uint8Value) StoredValue

func (v Uint8Value) StoredValue(_ atree.SlabStorage) (atree.Value, error)

func (Uint8Value) String

func (v Uint8Value) String() string

Jump to

Keyboard shortcuts

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