ir

package
v0.0.0-...-bbc9ce3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func ContainsUnknownField

func ContainsUnknownField(value Value) bool

ContainsUnknownField returns if the value or any subvalue contains an unknown field. Intended to allow bindings that don't support unknown fields to skip test cases that contain them.

func HandleRightsByName

func HandleRightsByName(rightsName string) (fidlgen.HandleRights, bool)

func HandleSubtypeByName

func HandleSubtypeByName(s string) (fidlgen.HandleSubtype, bool)

func TypeFromValue

func TypeFromValue(value Value) string

func ValidateAllType

func ValidateAllType(input All, generatorType string)

Types

type All

type All struct {
	EncodeSuccess []EncodeSuccess
	DecodeSuccess []DecodeSuccess
	EncodeFailure []EncodeFailure
	DecodeFailure []DecodeFailure
	Benchmark     []Benchmark
}

func FilterByBinding

func FilterByBinding(input All, binding string) All

func Merge

func Merge(input []All) All

type Benchmark

type Benchmark struct {
	Name                     string
	Value                    Record
	HandleDefs               []HandleDef
	BindingsAllowlist        *LanguageList
	BindingsDenylist         *LanguageList
	EnableSendEventBenchmark bool
	EnableEchoCallBenchmark  bool
}

type DecodeFailure

type DecodeFailure struct {
	Name              string
	Type              string
	Encodings         []Encoding
	HandleDefs        []HandleDef
	Err               ErrorCode
	BindingsAllowlist *LanguageList
	BindingsDenylist  *LanguageList
}

type DecodeSuccess

type DecodeSuccess struct {
	Name              string
	Value             Record
	Encodings         []Encoding
	HandleDefs        []HandleDef
	BindingsAllowlist *LanguageList
	BindingsDenylist  *LanguageList
}

type EncodeFailure

type EncodeFailure struct {
	Name              string
	Value             Record
	HandleDefs        []HandleDef
	Err               ErrorCode
	BindingsAllowlist *LanguageList
	BindingsDenylist  *LanguageList
}

type EncodeSuccess

type EncodeSuccess struct {
	Name              string
	Value             Record
	Encodings         []HandleDispositionEncoding
	HandleDefs        []HandleDef
	BindingsAllowlist *LanguageList
	BindingsDenylist  *LanguageList
	// CheckHandleRights is true for standalone "encode_success" tests providing
	// "handle_dispositions", but false for bidirectional "success" tests
	// because they provide only "handles" with no rights information.
	CheckHandleRights bool
}

type Encoding

type Encoding struct {
	WireFormat WireFormat
	Bytes      []byte
	Handles    []Handle
}

type ErrorCode

type ErrorCode string
const (
	CountExceedsLimit                  ErrorCode = "COUNT_EXCEEDS_LIMIT"
	EnvelopeBytesExceedMessageLength   ErrorCode = "ENVELOPE_BYTES_EXCEED_MESSAGE_LENGTH"
	EnvelopeHandlesExceedMessageLength ErrorCode = "ENVELOPE_HANDLES_EXCEED_MESSAGE_LENGTH"
	ExceededMaxOutOfLineDepth          ErrorCode = "EXCEEDED_MAX_OUT_OF_LINE_DEPTH"
	IncorrectHandleType                ErrorCode = "INCORRECT_HANDLE_TYPE"
	InvalidBoolean                     ErrorCode = "INVALID_BOOLEAN"
	InvalidEmptyStruct                 ErrorCode = "INVALID_EMPTY_STRUCT"
	InvalidInlineBitInEnvelope         ErrorCode = "INVALID_INLINE_BIT_IN_ENVELOPE"
	InvalidNumBytesInEnvelope          ErrorCode = "INVALID_NUM_BYTES_IN_ENVELOPE"
	InvalidNumHandlesInEnvelope        ErrorCode = "INVALID_NUM_HANDLES_IN_ENVELOPE"
	InvalidPaddingByte                 ErrorCode = "INVALID_PADDING_BYTE"
	InvalidPresenceIndicator           ErrorCode = "INVALID_PRESENCE_INDICATOR"
	MissingRequiredHandleRights        ErrorCode = "MISSING_REQUIRED_HANDLE_RIGHTS"
	NonEmptyStringWithNullBody         ErrorCode = "NON_EMPTY_STRING_WITH_NULL_BODY"
	NonEmptyVectorWithNullBody         ErrorCode = "NON_EMPTY_VECTOR_WITH_NULL_BODY"
	NonNullableTypeWithNullValue       ErrorCode = "NON_NULLABLE_TYPE_WITH_NULL_VALUE"
	NonResourceUnknownHandles          ErrorCode = "NON_RESOURCE_UNKNOWN_HANDLES"
	StrictBitsUnknownBit               ErrorCode = "STRICT_BITS_UNKNOWN_BIT"
	StrictEnumUnknownValue             ErrorCode = "STRICT_ENUM_UNKNOWN_VALUE"
	StrictUnionUnknownField            ErrorCode = "STRICT_UNION_UNKNOWN_FIELD"
	StringNotUtf8                      ErrorCode = "STRING_NOT_UTF8"
	StringTooLong                      ErrorCode = "STRING_TOO_LONG"
	TooFewBytes                        ErrorCode = "TOO_FEW_BYTES"
	TooFewBytesInPrimaryObject         ErrorCode = "TOO_FEW_BYTES_IN_PRIMARY_OBJECT"
	TooFewHandles                      ErrorCode = "TOO_FEW_HANDLES"
	TooManyBytesInMessage              ErrorCode = "TOO_MANY_BYTES_IN_MESSAGE"
	TooManyHandlesInMessage            ErrorCode = "TOO_MANY_HANDLES_IN_MESSAGE"
	UnexpectedOrdinal                  ErrorCode = "UNEXPECTED_ORDINAL"
	UnionFieldNotSet                   ErrorCode = "UNION_FIELD_NOT_SET"
)

type Field

type Field struct {
	Key   FieldKey
	Value Value
}

Field represents a field in a struct, table, or union value.

type FieldKey

type FieldKey struct {
	Name           string
	UnknownOrdinal uint64
}

FieldKey designates a field in a struct, table, or union type. The key is either known (represented by name) or unknown (represented by ordinal).

Only flexible tables and flexible unions can have unknown keys. Although known table/union fields (strict or flexible) have both a name and ordinal, FieldKey only stores the name.

func (*FieldKey) IsKnown

func (f *FieldKey) IsKnown() bool

IsKnown returns true if f is a known (i.e. named) key.

func (*FieldKey) IsUnknown

func (f *FieldKey) IsUnknown() bool

IsUnknown returns true if f is an unknown (i.e. ordinal) key.

type Handle

type Handle int

A Handle is an index into the test's []HandleDef.

func GetHandlesFromHandleDispositions

func GetHandlesFromHandleDispositions(handleDispositions []HandleDisposition) []Handle

func GetUnusedHandles

func GetUnusedHandles(value Value, handles []Handle) []Handle

GetUnusedHandles returns the list of handles from the input slice that do not appear in the provided Value

type HandleDef

type HandleDef struct {
	Subtype fidlgen.HandleSubtype
	Rights  fidlgen.HandleRights
}

type HandleDisposition

type HandleDisposition struct {
	Handle Handle
	Type   fidlgen.ObjectType
	Rights fidlgen.HandleRights
}

type HandleDispositionEncoding

type HandleDispositionEncoding struct {
	WireFormat         WireFormat
	Bytes              []byte
	HandleDispositions []HandleDisposition
}

type HandleWithRights

type HandleWithRights struct {
	Handle Handle
	Type   fidlgen.ObjectType
	Rights fidlgen.HandleRights
}

A HandleWithRights is a Handle with rights information.

type LanguageList

type LanguageList []string

func (LanguageList) Includes

func (list LanguageList) Includes(targetLanguage string) bool

type RawFloat

type RawFloat uint64

A RawFloat is an integer whose bytes specify an IEEE 754 single or double precision floating point number (sign bit = most significant bit). In the single-precision case, the value should be within uint32 range.

type Record

type Record struct {
	// Unqualified type name.
	Name string
	// List of fields. Struct and table records can have any number of fields.
	// Union records should have one field set, or no fields set to indicate the
	// union is default initialized (not all backends support this).
	Fields []Field
}

Record represents a value for a struct, table, or union type.

type UnknownData

type UnknownData struct {
	Bytes   []byte
	Handles []Handle
}

UnknownData represents the raw payload of an envelope, e.g. the data corresponding to an unknown variant of a union

type Value

type Value interface{}

Value represents any acceptable value used to represent a FIDL value. This type may wrap one of: - `string` for strings - `int64` for negative integers (of any size), bits, and enums - `uint64` for nonnegative integers (of any size), bits, and enums - `float64` or `RawFloat` for floating point numbers (of any size) - `bool` for booleans - `Handle` or `HandleWithRights` for handles - `Record` for structs, tables, and unions - `[]Value` for slices of values - `nil` for null values (only allowed for nullable types) - `UnknownData` for unknown variants of unions

type WireFormat

type WireFormat string
const (
	V1WireFormat WireFormat = "v1"
	V2WireFormat WireFormat = "v2"
)

func (WireFormat) String

func (wf WireFormat) String() string

type WireFormatList

type WireFormatList []WireFormat

func (WireFormatList) Includes

func (list WireFormatList) Includes(wireFormat WireFormat) bool

func (WireFormatList) Join

func (list WireFormatList) Join(sep string) string

Jump to

Keyboard shortcuts

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