예제 #1
0
func TestExtensiveFunction(t *testing.T) {
	function := nodes.Sum(1).Or(nodes.Count(2).And(nodes.Average(3)))
	expected := "(SUM(1) OR (COUNT(2) AND AVG(3)))"
	if got, _ := sql.Accept(function); expected != got {
		t.Errorf("TestExtensiveFunction was expected to return %s, got %s", expected, got)
	}
}
예제 #2
0
func TestAverage(t *testing.T) {
	avg := nodes.Average(1)
	expected := "AVG(1)"
	if got, _ := sql.Accept(avg); expected != got {
		t.Errorf("TestAverage was expected to return %s, got %s", expected, got)
	}
}
예제 #3
0
func TestCounter(t *testing.T) {
	avg := nodes.Average(1, 2, 3, 4)

	// The following struct members should exist.
	_ = avg.Expressions
	_ = avg.Alias
	_ = avg.Distinct

	// The following receiver methods should exist.
	_ = avg.And(1)
	_ = avg.Or(1)
	_ = avg.Eq(1)
	_ = avg.Neq(1)
	_ = avg.Gt(1)
	_ = avg.Gte(1)
	_ = avg.Lt(1)
	_ = avg.Lte(1)
	_ = avg.Like(1)
	_ = avg.Unlike(1)
}