ilt

package
v0.0.0-...-c349b99 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestConfigs map[string]*pb.GlobalConfig = map[string]*pb.GlobalConfig{
	"Expr/Eval": {
		Manifests: []*pb.AttributeManifest{
			{
				Attributes: map[string]*pb.AttributeManifest_AttributeInfo{
					"a": {
						ValueType: pbv.INT64,
					},
					"request.user": {
						ValueType: pbv.STRING,
					},
					"request.user2": {
						ValueType: pbv.STRING,
					},
					"request.user3": {
						ValueType: pbv.STRING,
					},
					"source.name": {
						ValueType: pbv.STRING,
					},
					"source.target": {
						ValueType: pbv.STRING,
					},
					"request.size": {
						ValueType: pbv.INT64,
					},
					"request.size1": {
						ValueType: pbv.INT64,
					},
					"x": {
						ValueType: pbv.INT64,
					},
					"y": {
						ValueType: pbv.INT64,
					},
					"service.name": {
						ValueType: pbv.STRING,
					},
					"service.user": {
						ValueType: pbv.STRING,
					},
					"origin.name": {
						ValueType: pbv.STRING,
					},
					"request.header": {
						ValueType: pbv.STRING_MAP,
					},
					"request.time": {
						ValueType: pbv.TIMESTAMP,
					},
					"headername": {
						ValueType: pbv.STRING,
					},
					"target.ip": {
						ValueType: pbv.IP_ADDRESS,
					},
					"servicename": {
						ValueType: pbv.STRING,
					},
				},
			},
		},
	},
	"Default": {
		Manifests: []*pb.AttributeManifest{
			{
				Attributes: map[string]*pb.AttributeManifest_AttributeInfo{
					"ai": {
						ValueType: pbv.INT64,
					},
					"ab": {
						ValueType: pbv.BOOL,
					},
					"as": {
						ValueType: pbv.STRING,
					},
					"ad": {
						ValueType: pbv.DOUBLE,
					},
					"ar": {
						ValueType: pbv.STRING_MAP,
					},
					"adur": {
						ValueType: pbv.DURATION,
					},
					"at": {
						ValueType: pbv.TIMESTAMP,
					},
					"aip": {
						ValueType: pbv.IP_ADDRESS,
					},
					"bi": {
						ValueType: pbv.INT64,
					},
					"bb": {
						ValueType: pbv.BOOL,
					},
					"bs": {
						ValueType: pbv.STRING,
					},
					"bd": {
						ValueType: pbv.DOUBLE,
					},
					"br": {
						ValueType: pbv.STRING_MAP,
					},
					"bdur": {
						ValueType: pbv.DURATION,
					},
					"bt": {
						ValueType: pbv.TIMESTAMP,
					},
					"t1": {
						ValueType: pbv.TIMESTAMP,
					},
					"t2": {
						ValueType: pbv.TIMESTAMP,
					},
					"bip": {
						ValueType: pbv.IP_ADDRESS,
					},
					"b1": {
						ValueType: pbv.BOOL,
					},
					"b2": {
						ValueType: pbv.BOOL,
					},
					"sm": {
						ValueType: pbv.STRING_MAP,
					},
				},
			},
		},
	},
}

TestConfigs uses a standard set of configs to use when executing tests.

View Source
var TestData = []TestInfo{}/* 145 elements not displayed */

Functions

func AreEqual

func AreEqual(e interface{}, a interface{}) bool

AreEqual checks for equality of given values. It handles comparison of []byte as a special case.

Types

type FakeBag

type FakeBag struct {
	Attrs map[string]interface{}
}

FakeBag is a fake implementation of the Bag for testing purposes.

func (*FakeBag) DebugString

func (b *FakeBag) DebugString() string

DebugString is needed to implement the Bag interface.

func (*FakeBag) Done

func (b *FakeBag) Done()

Done indicates the bag can be reclaimed.

func (*FakeBag) Get

func (b *FakeBag) Get(name string) (interface{}, bool)

Get returns an attribute value.

func (*FakeBag) Names

func (b *FakeBag) Names() []string

Names return the names of all the attributes known to this bag.

type TestInfo

type TestInfo struct {
	// E contains the expression that is being tested.
	E string

	// IL contains the textual IL representation of code.
	IL string

	// I contains the attribute bag used for testing.
	I map[string]interface{}

	// R contains the expected result of a successful evaluation.
	R interface{}

	// Err contains the expected error message of a failed evaluation.
	Err string

	// AstErr contains the expected error message of a failed evaluation, during AST evaluation.
	AstErr string

	// CompileErr contains the expected error message for a failed compilation.
	CompileErr string

	// Config field holds the GlobalConfig to use when compiling/evaluating the tests.
	// If nil, then "Default" config will be used.
	Conf *pb.GlobalConfig

	// SkipAst indicates that AST based evaluator should not be used for this test.
	SkipAst bool
}

TestInfo is a structure that contains detailed test information. Depending on the test type, various fields of the TestInfo struct will be used for testing purposes. For example, compiler can use E and IL to test expression => IL conversion, interpreter can use IL and I, R&Err for evaluation tests and the evaluator can use expression and I, R&Err to test evaluation.

Jump to

Keyboard shortcuts

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