func ExprLiteral(id int64, value interface{}) *exprpb.Expr {
	var literal *exprpb.Constant
	switch value.(type) {
	case bool:
		literal = &exprpb.Constant{ConstantKind: &exprpb.Constant_BoolValue{
			BoolValue: value.(bool)}}
	case int64:
		literal = &exprpb.Constant{ConstantKind: &exprpb.Constant_Int64Value{
			Int64Value: value.(int64)}}
	case uint64:
		literal = &exprpb.Constant{ConstantKind: &exprpb.Constant_Uint64Value{
			Uint64Value: value.(uint64)}}
	case float64:
		literal = &exprpb.Constant{ConstantKind: &exprpb.Constant_DoubleValue{
			DoubleValue: value.(float64)}}
	case string:
		literal = &exprpb.Constant{ConstantKind: &exprpb.Constant_StringValue{
			StringValue: value.(string)}}
	case structpb.NullValue:
		literal = &exprpb.Constant{ConstantKind: &exprpb.Constant_NullValue{
			NullValue: value.(structpb.NullValue)}}
	case []byte:
		literal = &exprpb.Constant{ConstantKind: &exprpb.Constant_BytesValue{
			BytesValue: value.([]byte)}}
	default:
		panic("literal type not implemented")
	}
	return &exprpb.Expr{Id: id, ExprKind: &exprpb.Expr_ConstExpr{ConstExpr: literal}}
}
ExprLiteral creates a literal (constant) Expr.
package test
import (
	"github.com/google/cel-go/common/operators"
	"google.golang.org/protobuf/proto"
	exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
	structpb "google.golang.org/protobuf/types/known/structpb"
)
type TestExpr struct {
	Expr       *exprpb.Expr
	SourceInfo *exprpb.SourceInfo
}
func (t *TestExpr) Info(location string) *exprpb.SourceInfo {
	info := proto.Clone(t.SourceInfo).(*exprpb.SourceInfo)
	info.Location = location
	return info
}
var (
	Empty = &TestExpr{
		Expr: &exprpb.Expr{},
		SourceInfo: &exprpb.SourceInfo{
			LineOffsets: []int32{},
			Positions:   map[int64]int32{}}}
	Exists = &TestExpr{
		Expr: ExprComprehension(1,
			"x",
			ExprList(8,
				ExprLiteral(2, int64(0)),
				ExprLiteral(3, int64(1)),
				ExprLiteral(4, int64(2)),
				ExprLiteral(5, int64(3)),
				ExprLiteral(6, int64(4)),
				ExprLiteral(7, uint64(5))),
			"__result__",
			ExprLiteral(9, false),
			ExprCall(12,
				operators.NotStrictlyFalse,
				ExprCall(10,
					operators.LogicalNot,
					ExprIdent(11, "__result__"))),
			ExprCall(13,
				operators.LogicalOr,
				ExprIdent(14, "__result__"),
				ExprCall(15,
					operators.Equals,
					ExprCall(16,
						"type",
						ExprIdent(17, "x")),
					ExprIdent(18, "uint"))),
			ExprIdent(19, "__result__")),
		SourceInfo: &exprpb.SourceInfo{
			LineOffsets: []int32{0},
			Positions: map[int64]int32{
				0:  12,
				1:  0,
				2:  1,
				3:  4,
				4:  8,
				5:  0,
				6:  18,
				7:  18,
				8:  18,
				9:  18,
				10: 18,
				11: 20,
				12: 20,
				13: 28,
				14: 28,
				15: 28,
				16: 28,
				17: 28,
				18: 28,
				19: 28}}}
	ExistsWithInput = &TestExpr{
		Expr: ExprComprehension(1,
			"x",
			ExprIdent(2, "elems"),
			"__result__",
			ExprLiteral(3, false),
			ExprCall(4,
				operators.LogicalNot,
				ExprIdent(5, "__result__")),
			ExprCall(6,
				operators.Equals,
				ExprCall(7,
					"type",
					ExprIdent(8, "x")),
				ExprIdent(9, "uint")),
			ExprIdent(10, "__result__")),
		SourceInfo: &exprpb.SourceInfo{
			LineOffsets: []int32{0},
			Positions: map[int64]int32{
				0:  12,
				1:  0,
				2:  1,
				3:  4,
				4:  8,
				5:  0,
				6:  18,
				7:  18,
				8:  18,
				9:  18,
				10: 18}}}
	DynMap = &TestExpr{
		Expr: ExprMap(17,
			ExprEntry(2,
				ExprLiteral(1, "hello"),
				ExprMemberCall(3,
					"size",
					ExprLiteral(4, "world"))),
			ExprEntry(12,
				ExprLiteral(11, "null"),
				ExprLiteral(13, structpb.NullValue_NULL_VALUE)),
			ExprEntry(15,
				ExprLiteral(14, "bytes"),
				ExprLiteral(16, []byte("bytes-string")))),
		SourceInfo: &exprpb.SourceInfo{
			LineOffsets: []int32{},
			Positions:   map[int64]int32{}}}
	LogicalAnd = &TestExpr{
		ExprCall(2, operators.LogicalAnd,
			ExprIdent(1, "a"),
			ExprSelect(8,
				ExprMap(5,
					ExprEntry(4, ExprLiteral(6, "c"), ExprLiteral(7, true))),
				"c")),
		&exprpb.SourceInfo{
			LineOffsets: []int32{},
			Positions:   map[int64]int32{}}}
	LogicalOr = &TestExpr{
		ExprCall(2, operators.LogicalOr,
			ExprSelect(8,
				ExprMap(5,
					ExprEntry(4, ExprLiteral(6, "c"), ExprLiteral(7, false))),
				"c"),
			ExprIdent(1, "a")),
		&exprpb.SourceInfo{
			LineOffsets: []int32{},
			Positions:   map[int64]int32{}}}
	LogicalOrEquals = &TestExpr{
		ExprCall(5, operators.LogicalOr,
			ExprIdent(1, "a"),
			ExprCall(4, operators.Equals,
				ExprIdent(2, "b"),
				ExprLiteral(3, "b"))),
		&exprpb.SourceInfo{
			LineOffsets: []int32{},
			Positions:   map[int64]int32{}}}
	LogicalAndMissingType = &TestExpr{
		ExprCall(2, operators.LogicalAnd,
			ExprIdent(1, "a"),
			ExprSelect(7,
				ExprType(5, "TestProto",
					ExprField(4, "c", ExprLiteral(6, true))),
				"c")),
		&exprpb.SourceInfo{
			LineOffsets: []int32{},
			Positions:   map[int64]int32{}}}
	Conditional = &TestExpr{
		Expr: ExprCall(9, operators.Conditional,
			ExprIdent(1, "a"),
			ExprCall(3,
				operators.Less,
				ExprIdent(2, "b"),
				ExprLiteral(4, 1.0)),
			ExprCall(6,
				operators.Equals,
				ExprIdent(5, "c"),
				ExprList(8, ExprLiteral(7, "hello")))),
		SourceInfo: &exprpb.SourceInfo{
			LineOffsets: []int32{},
			Positions:   map[int64]int32{}}}
	Select = &TestExpr{
		Expr: ExprSelect(3,
			ExprSelect(2,
				ExprIdent(1, "a"),
				"b"),
			"c"),
		SourceInfo: &exprpb.SourceInfo{
			LineOffsets: []int32{},
			Positions:   map[int64]int32{}}}
	Equality = &TestExpr{
		Expr: ExprCall(2,
			operators.Equals,
			ExprIdent(1, "a"),
			ExprLiteral(3, int64(42))),
		SourceInfo: &exprpb.SourceInfo{
			LineOffsets: []int32{},
			Positions:   map[int64]int32{}}}
	TypeEquality = &TestExpr{
		Expr: ExprCall(4,
			operators.Equals,
			ExprCall(1, "type",
				ExprIdent(2, "a")),
			ExprIdent(3, "uint")),
		SourceInfo: &exprpb.SourceInfo{
			LineOffsets: []int32{},
			Positions:   map[int64]int32{}}}
)
func ExprIdent(id int64, name string) *exprpb.Expr {
	return &exprpb.Expr{Id: id, ExprKind: &exprpb.Expr_IdentExpr{
		IdentExpr: &exprpb.Expr_Ident{Name: name}}}
}
func ExprSelect(id int64, operand *exprpb.Expr, field string) *exprpb.Expr {
	return &exprpb.Expr{Id: id,
		ExprKind: &exprpb.Expr_SelectExpr{
			SelectExpr: &exprpb.Expr_Select{
				Operand:  operand,
				Field:    field,
				TestOnly: false}}}
}