Esempio n. 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)
	}
}
Esempio n. 2
0
func TestCount(t *testing.T) {
	count := nodes.Count(1)
	expected := "COUNT(1)"
	if got, _ := sql.Accept(count); expected != got {
		t.Errorf("TestCount was expected to return %s, got %s", expected, got)
	}
}
Esempio n. 3
0
func TestCount(t *testing.T) {
	count := nodes.Count(1, 2, 3, 4)

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

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