コード例 #1
0
ファイル: builtins_test.go プロジェクト: kyledj/qlbridge
type testBuiltins struct {
	expr string
	val  value.Value
}

var (
	// This is used so we have a constant understood time for message context
	// normally we would use time.Now()
	//   "Apr 7, 2014 4:58:55 PM"
	ts          = time.Date(2014, 4, 7, 16, 58, 55, 00, time.UTC)
	ts2         = time.Date(2014, 4, 7, 0, 0, 0, 00, time.UTC)
	readContext = datasource.NewContextUrlValuesTs(url.Values{
		"event":        {"hello"},
		"reg_date":     {"10/13/2014"},
		"price":        {"$55"},
		"email":        {"*****@*****.**"},
		"url":          {"http://www.site.com/membership/all.html"},
		"score_amount": {"22"},
		"tag_name":     {"bob"},
	}, ts)
	float3pt1 = float64(3.1)
)

var builtinTests = []testBuiltins{

	{`join(["apple","peach"], ",")`, value.NewStringValue("apple,peach")},

	{`eq(5,5)`, value.BoolValueTrue},
	{`eq('hello', event)`, value.BoolValueTrue},
	{`eq(5,6)`, value.BoolValueFalse},
	{`eq(true,eq(5,5))`, value.BoolValueTrue},
コード例 #2
0
ファイル: builtins_test.go プロジェクト: chrislusf/qlbridge
}

type testBuiltins struct {
	expr string
	val  value.Value
}

var (
	// This is used so we have a constant understood time for message context
	// normally we would use time.Now()
	//   "Apr 7, 2014 4:58:55 PM"
	ts          = time.Date(2014, 4, 7, 16, 58, 55, 00, time.UTC)
	readContext = datasource.NewContextUrlValuesTs(url.Values{
		"event":        {"hello"},
		"reg_date":     {"10/13/2014"},
		"price":        {"$55"},
		"email":        {"*****@*****.**"},
		"score_amount": {"22"},
	}, ts)
	float3pt1 = float64(3.1)
)

var builtinTests = []testBuiltins{

	{`eq(5,5)`, value.BoolValueTrue},
	{`eq('hello', event)`, value.BoolValueTrue},
	{`eq(5,6)`, value.BoolValueFalse},
	{`eq(true,eq(5,5))`, value.BoolValueTrue},
	{`eq(true,false)`, value.BoolValueFalse},

	{`ne(5,5)`, value.BoolValueFalse},