testcmd

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package testcmd provides fake commands used for testing.

Index

Constants

This section is empty.

Variables

View Source
var (
	APIID = api.ID{1, 2, 3}

	P = &X{
		Str:  "aaa",
		Sli:  []bool{true, false, true},
		Ref:  &Struct{Str: "ccc", Ref: &Struct{Str: "ddd"}},
		Ptr:  Pointer(0x123),
		Map:  StringːString{map[string]string{"cat": "meow", "dog": "woof"}},
		PMap: IntːStructPtr{map[int]*Struct{}},
		RMap: map[string]string{"eyes": "see", "nose": "smells"},
	}

	Q = &X{
		Str: "xyz",
		Sli: []bool{false, true, false},
		Ptr: Pointer(0x321),
		Map: StringːString{map[string]string{"bird": "tweet", "fox": "?"}},
		PMap: IntːStructPtr{map[int]*Struct{
			100: &Struct{Str: "baldrick"},
		}},
		RMap: map[string]string{"ears": "hear", "tongue": "taste"},
	}
)

Functions

This section is empty.

Types

type A

type A struct {
	ID    api.CmdID
	Flags api.CmdFlags
}

func (*A) API

func (a *A) API() api.API

func (*A) Caller added in v0.6.0

func (a *A) Caller() api.CmdID

func (*A) CmdFlags

func (a *A) CmdFlags(context.Context, api.CmdID, *api.GlobalState) api.CmdFlags

func (*A) CmdName

func (a *A) CmdName() string

func (*A) Extras

func (a *A) Extras() *api.CmdExtras

func (*A) Mutate

func (*A) SetCaller added in v0.6.0

func (a *A) SetCaller(api.CmdID)

func (*A) SetThread

func (a *A) SetThread(uint64)

func (*A) Thread

func (a *A) Thread() uint64

type API

type API struct{}

func (API) ConstantSets

func (API) ConstantSets() *constset.Pack

func (API) Context

func (API) Context(*api.GlobalState, uint64) api.Context

func (API) CreateCmd

func (API) CreateCmd(name string) api.Cmd

func (API) GetFramebufferAttachmentInfo

func (API) GetFramebufferAttachmentInfo(
	ctx context.Context,
	after []uint64,
	state *api.GlobalState,
	thread uint64,
	attachment api.FramebufferAttachment) (api.FramebufferAttachmentInfo, error)

func (API) ID

func (API) ID() api.ID

func (API) Index

func (API) Index() uint8

func (API) Name

func (API) Name() string

type B

type B struct {
	ID   api.CmdID
	Bool bool
}

func (*B) API

func (*B) API() api.API

func (*B) Caller added in v0.6.0

func (*B) Caller() api.CmdID

func (*B) CmdFlags

func (*B) CmdName

func (*B) CmdName() string

func (*B) Extras

func (*B) Extras() *api.CmdExtras

func (*B) Mutate

func (*B) SetCaller added in v0.6.0

func (*B) SetCaller(api.CmdID)

func (*B) SetThread

func (*B) SetThread(uint64)

func (*B) Thread

func (*B) Thread() uint64

type CmdAndID

type CmdAndID struct {
	Cmd api.Cmd
	Id  api.CmdID
}

type CmdAndIDList

type CmdAndIDList []CmdAndID

func List

func List(cmds ...interface{}) CmdAndIDList

List takes a mix of Cmds and CmdIDsAndCmd and returns a CmdIDListAndCmd. Cmds are transformed into CmdIDsAndCmd by using the ID field as the command id.

func (*CmdAndIDList) Write

func (l *CmdAndIDList) Write(ctx context.Context, id api.CmdID, c api.Cmd)

type IntːStructPtr

type IntːStructPtr struct{ M map[int]*Struct }

func (IntːStructPtr) Add added in v1.1.0

func (m IntːStructPtr) Add(k int, v *Struct)

Add inserts the key-value pair, replacing any existing entry with the same key.

func (*IntːStructPtr) Assign added in v0.9.0

func (m *IntːStructPtr) Assign(v interface{}) bool

func (IntːStructPtr) Contains added in v1.1.0

func (m IntːStructPtr) Contains(k int) bool

Contains returns true if the dictionary contains an entry with the given key.

func (IntːStructPtr) Get added in v1.1.0

func (m IntːStructPtr) Get(k int) *Struct

Get returns the value of the entry with the given key.

func (IntːStructPtr) Keys added in v1.1.0

func (m IntːStructPtr) Keys() []int

Keys returns all the entry keys in the map.

func (IntːStructPtr) Len added in v1.1.0

func (m IntːStructPtr) Len() int

Len returns the number of entries in the dictionary.

func (IntːStructPtr) Lookup added in v1.1.0

func (m IntːStructPtr) Lookup(k int) (val *Struct, ok bool)

Lookup searches for the value of the entry with the given key.

func (IntːStructPtr) Remove added in v1.1.0

func (m IntːStructPtr) Remove(k int)

Remove removes the entry with the given key. If no entry with the given key exists then this call is a no-op.

type Pointer

type Pointer uint64

func (Pointer) APointer added in v1.0.1

func (p Pointer) APointer()

func (Pointer) Address

func (p Pointer) Address() uint64

func (*Pointer) Assign

func (p *Pointer) Assign(o interface{}) bool

func (Pointer) ElementSize

func (p Pointer) ElementSize(m *device.MemoryLayout) uint64

func (Pointer) ElementType

func (p Pointer) ElementType() reflect.Type

func (Pointer) ISlice

func (p Pointer) ISlice(start, end uint64, m *device.MemoryLayout) memory.Slice

func (Pointer) IsNullptr

func (p Pointer) IsNullptr() bool

func (Pointer) Offset

func (p Pointer) Offset(n uint64) memory.Pointer

func (Pointer) String

func (p Pointer) String() string

type RawIntːStructPtr added in v0.9.0

type RawIntːStructPtr map[string]string

type StringːString

type StringːString struct{ M map[string]string }

func (StringːString) Add added in v1.1.0

func (m StringːString) Add(k, v string)

Add inserts the key-value pair, replacing any existing entry with the same key.

func (*StringːString) Assign added in v0.9.0

func (m *StringːString) Assign(v interface{}) bool

func (StringːString) Contains added in v1.1.0

func (m StringːString) Contains(k string) bool

Contains returns true if the dictionary contains an entry with the given key.

func (StringːString) Get added in v1.1.0

func (m StringːString) Get(k string) string

Get returns the value of the entry with the given key.

func (StringːString) Keys added in v1.1.0

func (m StringːString) Keys() []string

Keys returns all the entry keys in the map.

func (StringːString) Len added in v1.1.0

func (m StringːString) Len() int

Len returns the number of entries in the dictionary.

func (StringːString) Lookup added in v1.1.0

func (m StringːString) Lookup(k string) (val string, ok bool)

Lookup searches for the value of the entry with the given key.

func (StringːString) Remove added in v1.1.0

func (m StringːString) Remove(k string)

Remove removes the entry with the given key. If no entry with the given key exists then this call is a no-op.

type Struct

type Struct struct {
	Str string
	Ref *Struct
}

type Writer

type Writer struct {
	S          *api.GlobalState
	Cmds       []api.Cmd
	CmdsAndIDs []CmdAndID
}

Writer is a transform.Writer that record all commands that pass through it.

func (*Writer) MutateAndWrite

func (w *Writer) MutateAndWrite(ctx context.Context, id api.CmdID, cmd api.Cmd)

func (*Writer) State

func (w *Writer) State() *api.GlobalState

type X

type X struct {
	Str  string           `param:"Str"`
	Sli  []bool           `param:"Sli"`
	Ref  *Struct          `param:"Ref"`
	Ptr  Pointer          `param:"Ptr"`
	Map  StringːString    `param:"Map"`
	PMap IntːStructPtr    `param:"PMap"`
	RMap RawIntːStructPtr `param:"RMap"`
}

func (X) API

func (X) API() api.API

func (X) Caller added in v0.6.0

func (X) Caller() api.CmdID

func (X) CmdFlags

func (X) CmdName

func (X) CmdName() string

func (X) Extras

func (X) Extras() *api.CmdExtras

func (X) SetCaller added in v0.6.0

func (X) SetCaller(api.CmdID)

func (X) SetThread

func (X) SetThread(uint64)

func (X) Thread

func (X) Thread() uint64

Directories

Path Synopsis
Package test_pb describes the serialization format for the test api.
Package test_pb describes the serialization format for the test api.

Jump to

Keyboard shortcuts

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